Differential D20178 Diff 48208 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 110 Lines • ▼ Show 20 Lines | public function execute(PhutilArgumentParser $args) { | ||||
$any_success = false; | $any_success = false; | ||||
// If we aren't using "--background" or "--force", track how many objects | // If we aren't using "--background" or "--force", track how many objects | ||||
// we're skipping so we can print this information for the user and give | // we're skipping so we can print this information for the user and give | ||||
// them a hint that they might want to use "--force". | // them a hint that they might want to use "--force". | ||||
$track_skips = (!$is_background && !$is_force); | $track_skips = (!$is_background && !$is_force); | ||||
// Activate "strict" error reporting if we're running in the foreground | |||||
// so we'll report a wider range of conditions as errors. | |||||
$is_strict = !$is_background; | |||||
$count_updated = 0; | $count_updated = 0; | ||||
$count_skipped = 0; | $count_skipped = 0; | ||||
foreach ($phids as $phid) { | foreach ($phids as $phid) { | ||||
try { | try { | ||||
if ($track_skips) { | if ($track_skips) { | ||||
$old_versions = $this->loadIndexVersions($phid); | $old_versions = $this->loadIndexVersions($phid); | ||||
} | } | ||||
PhabricatorSearchWorker::queueDocumentForIndexing($phid, $parameters); | PhabricatorSearchWorker::queueDocumentForIndexing( | ||||
$phid, | |||||
$parameters, | |||||
$is_strict); | |||||
if ($track_skips) { | if ($track_skips) { | ||||
$new_versions = $this->loadIndexVersions($phid); | $new_versions = $this->loadIndexVersions($phid); | ||||
if ($old_versions !== $new_versions) { | if ($old_versions !== $new_versions) { | ||||
$count_updated++; | $count_updated++; | ||||
} else { | } else { | ||||
$count_skipped++; | $count_skipped++; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines |