Path: blob/master/src/applications/config/check/PhabricatorManualActivitySetupCheck.php
12256 views
<?php12final class PhabricatorManualActivitySetupCheck3extends PhabricatorSetupCheck {45public function getDefaultGroup() {6return self::GROUP_OTHER;7}89protected function executeChecks() {10$activities = id(new PhabricatorConfigManualActivity())->loadAll();1112foreach ($activities as $activity) {13$type = $activity->getActivityType();1415switch ($type) {16case PhabricatorConfigManualActivity::TYPE_REINDEX:17$this->raiseSearchReindexIssue();18break;1920case PhabricatorConfigManualActivity::TYPE_IDENTITIES:21$this->raiseRebuildIdentitiesIssue();22break;2324default:25}26}27}2829private function raiseSearchReindexIssue() {30$activity_name = pht('Rebuild Search Index');31$activity_summary = pht(32'The search index algorithm has been updated and the index needs '.33'be rebuilt.');3435$message = array();3637$message[] = pht(38'The indexing algorithm for the fulltext search index has been '.39'updated and the index needs to be rebuilt. Until you rebuild the '.40'index, global search (and other fulltext search) will not '.41'function correctly.');4243$message[] = pht(44'You can rebuild the search index while the server is running.');4546$message[] = pht(47'To rebuild the index, run this command:');4849$message[] = phutil_tag(50'pre',51array(),52(string)csprintf(53'$ ./bin/search index --all --force --background'));5455$message[] = pht(56'You can find more information about rebuilding the search '.57'index here: %s',58phutil_tag(59'a',60array(61'href' => 'https://phurl.io/u/reindex',62'target' => '_blank',63),64'https://phurl.io/u/reindex'));6566$message[] = pht(67'After rebuilding the index, run this command to clear this setup '.68'warning:');6970$message[] = phutil_tag(71'pre',72array(),73'$ ./bin/config done reindex');7475$activity_message = phutil_implode_html("\n\n", $message);7677$this->newIssue('manual.reindex')78->setName($activity_name)79->setSummary($activity_summary)80->setMessage($activity_message);81}8283private function raiseRebuildIdentitiesIssue() {84$activity_name = pht('Rebuild Repository Identities');85$activity_summary = pht(86'The mapping from VCS users to %s users has changed '.87'and must be rebuilt.',88PlatformSymbols::getPlatformServerName());8990$message = array();9192$message[] = pht(93'The way VCS activity is attributed %s user accounts has changed.',94PlatformSymbols::getPlatformServerName());9596$message[] = pht(97'There is a new indirection layer between the strings that appear as '.98'VCS authors and committers (such as "John Developer '.99'<[email protected]>") and the user account that gets associated '.100'with VCS commits.');101102$message[] = pht(103'This change supports situations where users are incorrectly '.104'associated with commits because the software makes a bad guess '.105'about how the VCS string maps to a user account. '.106'This also helps with situations where existing repositories are '.107'imported without having created accounts for all the committers to '.108'that repository. Until you rebuild these repository identities, you '.109'are likely to encounter problems with features which rely on the '.110'existence of these identities.');111112$message[] = pht(113'You can rebuild repository identities while the server is running.');114115$message[] = pht(116'To rebuild identities, run this command:');117118$message[] = phutil_tag(119'pre',120array(),121(string)csprintf(122'$ ./bin/repository rebuild-identities --all-repositories'));123124$message[] = pht(125'You can find more information about this new identity mapping '.126'here: %s',127phutil_tag(128'a',129array(130'href' => 'https://phurl.io/u/repoIdentities',131'target' => '_blank',132),133'https://phurl.io/u/repoIdentities'));134135$message[] = pht(136'After rebuilding repository identities, run this command to clear '.137'this setup warning:');138139$message[] = phutil_tag(140'pre',141array(),142'$ ./bin/config done identities');143144$activity_message = phutil_implode_html("\n\n", $message);145146$this->newIssue('manual.identities')147->setName($activity_name)148->setSummary($activity_summary)149->setMessage($activity_message);150}151152}153154155