diff --git a/src/applications/config/check/PhabricatorElasticsearchSetupCheck.php b/src/applications/config/check/PhabricatorElasticsearchSetupCheck.php index 157db5e141..cd29ecdc78 100644 --- a/src/applications/config/check/PhabricatorElasticsearchSetupCheck.php +++ b/src/applications/config/check/PhabricatorElasticsearchSetupCheck.php @@ -1,82 +1,88 @@ getAnyHostForRole('read'); } catch (PhabricatorClusterNoHostForRoleException $e) { // ignore the error continue; } if ($host instanceof PhabricatorElasticsearchHost) { $index_exists = null; $index_sane = null; try { $engine = $host->getEngine(); $index_exists = $engine->indexExists(); if ($index_exists) { $index_sane = $engine->indexIsSane(); } } catch (Exception $ex) { $summary = pht('Elasticsearch is not reachable as configured.'); $message = pht( 'Elasticsearch is configured (with the %s setting) but Phabricator'. ' encountered an exception when trying to test the index.'. "\n\n". '%s', phutil_tag('tt', array(), 'cluster.search'), phutil_tag('pre', array(), $ex->getMessage())); $this->newIssue('elastic.misconfigured') ->setName(pht('Elasticsearch Misconfigured')) ->setSummary($summary) ->setMessage($message) ->addRelatedPhabricatorConfig('cluster.search'); return; } if (!$index_exists) { $summary = pht( 'You enabled Elasticsearch but the index does not exist.'); $message = pht( 'You likely enabled cluster.search without creating the '. 'index. Use the following command to create a new index.'); $this ->newIssue('elastic.missing-index') ->setName(pht('Elasticsearch Index Not Found')) ->addCommand('./bin/search init') ->setSummary($summary) ->setMessage($message); } else if (!$index_sane) { $summary = pht( 'Elasticsearch index exists but needs correction.'); $message = pht( 'Either the Phabricator schema for Elasticsearch has changed '. 'or Elasticsearch created the index automatically. '. 'Use the following command to rebuild the index.'); $this ->newIssue('elastic.broken-index') ->setName(pht('Elasticsearch Index Schema Mismatch')) ->addCommand('./bin/search init') ->setSummary($summary) ->setMessage($message); } } } } }