mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 02:12:41 +01:00
Reduce the verbosity of the ./bin/search index
script.
Summary: Currently, the `./bin/search index` script produces a lot of output (one line for every indexed object). Instead, use a `PhutilConsoleProgressBar` to indicate progress. This is much less verbose and gives a real indication of how long the script should take to complete. Test Plan: Ran `./bin/search index` and verified that a progress bar was output. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9364
This commit is contained in:
parent
1503840cd9
commit
c86604bad8
1 changed files with 15 additions and 12 deletions
|
@ -62,8 +62,7 @@ final class PhabricatorSearchManagementIndexWorkflow
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$phids) {
|
if (!$phids) {
|
||||||
throw new PhutilArgumentUsageException(
|
throw new PhutilArgumentUsageException('Nothing to index!');
|
||||||
"Nothing to index!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($args->getArg('background')) {
|
if ($args->getArg('background')) {
|
||||||
|
@ -73,27 +72,31 @@ final class PhabricatorSearchManagementIndexWorkflow
|
||||||
$is_background = false;
|
$is_background = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$is_background) {
|
||||||
|
$console->writeOut(
|
||||||
|
"%s\n",
|
||||||
|
pht(
|
||||||
|
'Run this workflow with "--background" to queue tasks for the '.
|
||||||
|
'daemon workers.'));
|
||||||
|
}
|
||||||
|
|
||||||
$groups = phid_group_by_type($phids);
|
$groups = phid_group_by_type($phids);
|
||||||
foreach ($groups as $group_type => $group) {
|
foreach ($groups as $group_type => $group) {
|
||||||
$console->writeOut(
|
$console->writeOut(
|
||||||
"%s\n",
|
"%s\n",
|
||||||
pht(
|
pht('Indexing %d object(s) of type %s.', count($group), $group_type));
|
||||||
"Indexing %d object(s) of type %s.",
|
|
||||||
count($group),
|
|
||||||
$group_type));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$bar = id(new PhutilConsoleProgressBar())
|
||||||
|
->setTotal(count($phids));
|
||||||
|
|
||||||
$indexer = new PhabricatorSearchIndexer();
|
$indexer = new PhabricatorSearchIndexer();
|
||||||
foreach ($phids as $phid) {
|
foreach ($phids as $phid) {
|
||||||
if ($is_background) {
|
|
||||||
$console->writeOut("%s\n", pht("Queueing '%s'...", $phid));
|
|
||||||
} else {
|
|
||||||
$console->writeOut("%s\n", pht("Indexing '%s'...", $phid));
|
|
||||||
}
|
|
||||||
$indexer->queueDocumentForIndexing($phid);
|
$indexer->queueDocumentForIndexing($phid);
|
||||||
|
$bar->update(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$console->writeOut("Done.\n");
|
$bar->done();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadPHIDsByNames(array $names) {
|
private function loadPHIDsByNames(array $names) {
|
||||||
|
|
Loading…
Reference in a new issue