本文整理汇总了PHP中PhabricatorProject::loadAll方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorProject::loadAll方法的具体用法?PHP PhabricatorProject::loadAll怎么用?PHP PhabricatorProject::loadAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorProject
的用法示例。
在下文中一共展示了PhabricatorProject::loadAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pht
<?php
echo pht('Ensuring project names are unique enough...') . "\n";
$table = new PhabricatorProject();
$table->openTransaction();
$table->beginReadLocking();
$projects = $table->loadAll();
$slug_map = array();
foreach ($projects as $project) {
$project->setPhrictionSlug($project->getName());
$slug = $project->getPhrictionSlug();
if ($slug == '/') {
$project_id = $project->getID();
echo pht("Project #%d doesn't have a meaningful name...", $project_id) . "\n";
$project->setName(trim(pht('Unnamed Project %s', $project->getName())));
}
$slug_map[$slug][] = $project->getID();
}
foreach ($slug_map as $slug => $similar) {
if (count($similar) <= 1) {
continue;
}
echo pht("Too many projects are similar to '%s'...", $slug) . "\n";
foreach (array_slice($similar, 1, null, true) as $key => $project_id) {
$project = $projects[$project_id];
$old_name = $project->getName();
$new_name = rename_project($project, $projects);
echo pht("Renaming project #%d from '%s' to '%s'.\n", $project_id, $old_name, $new_name);
$project->setName($new_name);
}
}