Differential D10955 Diff 26307 src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if ($obj_names && ($is_all || $is_type)) { | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
"You can not name objects to index alongside the '--all' or '--type' ". | "You can not name objects to index alongside the '--all' or '--type' ". | ||||
"flags."); | "flags."); | ||||
} else if (!$obj_names && !($is_all || $is_type)) { | } else if (!$obj_names && !($is_all || $is_type)) { | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
"Provide one of '--all', '--type' or a list of object names."); | "Provide one of '--all', '--type' or a list of object names."); | ||||
} | } | ||||
if (PhabricatorDefaultSearchEngineSelector::shouldUseElasticSearch()) { | |||||
$engine = PhabricatorSearchEngineSelector::newSelector()->newEngine(); | |||||
if (!$engine->indexExists()) { | |||||
$console->writeOut( | |||||
'%s', | |||||
pht('Index does not exist, creating...')); | |||||
$engine->createIndex(); | |||||
$console->writeOut( | |||||
"%s\n", | |||||
pht('done.')); | |||||
} | |||||
} | |||||
if ($obj_names) { | if ($obj_names) { | ||||
$phids = $this->loadPHIDsByNames($obj_names); | $phids = $this->loadPHIDsByNames($obj_names); | ||||
} else { | } else { | ||||
$phids = $this->loadPHIDsByTypes($is_type); | $phids = $this->loadPHIDsByTypes($is_type); | ||||
} | } | ||||
if (!$phids) { | if (!$phids) { | ||||
throw new PhutilArgumentUsageException('Nothing to index!'); | throw new PhutilArgumentUsageException('Nothing to index!'); | ||||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |