Differential D14841 Diff 35893 src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php
Show All 24 Lines | $this | ||||
array( | array( | ||||
'name' => 'background', | 'name' => 'background', | ||||
'help' => pht( | 'help' => pht( | ||||
'Instead of indexing in this process, queue tasks for '. | 'Instead of indexing in this process, queue tasks for '. | ||||
'the daemons. This can improve performance, but makes '. | 'the daemons. This can improve performance, but makes '. | ||||
'it more difficult to debug search indexing.'), | 'it more difficult to debug search indexing.'), | ||||
), | ), | ||||
array( | array( | ||||
'name' => 'force', | |||||
'short' => 'f', | |||||
'help' => pht( | |||||
'Force a complete rebuild of the entire index instead of an '. | |||||
'incremental update.'), | |||||
), | |||||
array( | |||||
'name' => 'objects', | 'name' => 'objects', | ||||
'wildcard' => true, | 'wildcard' => true, | ||||
), | ), | ||||
)); | )); | ||||
} | } | ||||
public function execute(PhutilArgumentParser $args) { | public function execute(PhutilArgumentParser $args) { | ||||
$console = PhutilConsole::getConsole(); | $console = PhutilConsole::getConsole(); | ||||
$is_all = $args->getArg('all'); | $is_all = $args->getArg('all'); | ||||
$is_type = $args->getArg('type'); | $is_type = $args->getArg('type'); | ||||
$is_force = $args->getArg('force'); | |||||
$obj_names = $args->getArg('objects'); | $obj_names = $args->getArg('objects'); | ||||
if ($obj_names && ($is_all || $is_type)) { | if ($obj_names && ($is_all || $is_type)) { | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
pht( | pht( | ||||
"You can not name objects to index alongside the '%s' or '%s' flags.", | "You can not name objects to index alongside the '%s' or '%s' flags.", | ||||
'--all', | '--all', | ||||
Show All 36 Lines | foreach ($groups as $group_type => $group) { | ||||
$console->writeOut( | $console->writeOut( | ||||
"%s\n", | "%s\n", | ||||
pht('Indexing %d object(s) of type %s.', count($group), $group_type)); | pht('Indexing %d object(s) of type %s.', count($group), $group_type)); | ||||
} | } | ||||
$bar = id(new PhutilConsoleProgressBar()) | $bar = id(new PhutilConsoleProgressBar()) | ||||
->setTotal(count($phids)); | ->setTotal(count($phids)); | ||||
$parameters = array( | |||||
'force' => $is_force, | |||||
); | |||||
$any_success = false; | $any_success = false; | ||||
foreach ($phids as $phid) { | foreach ($phids as $phid) { | ||||
try { | try { | ||||
PhabricatorSearchWorker::queueDocumentForIndexing($phid); | PhabricatorSearchWorker::queueDocumentForIndexing($phid, $parameters); | ||||
$any_success = true; | $any_success = true; | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
phlog($ex); | phlog($ex); | ||||
} | } | ||||
$bar->update(1); | $bar->update(1); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |