本文整理匯總了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);
}
}