Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/check/PhabricatorElasticSearchSetupCheck.php
<?php | <?php | ||||
final class PhabricatorElasticSearchSetupCheck extends PhabricatorSetupCheck { | final class PhabricatorElasticSearchSetupCheck extends PhabricatorSetupCheck { | ||||
public function getDefaultGroup() { | public function getDefaultGroup() { | ||||
return self::GROUP_OTHER; | return self::GROUP_OTHER; | ||||
} | } | ||||
protected function executeChecks() { | protected function executeChecks() { | ||||
if (!$this->shouldUseElasticSearchEngine()) { | if (!$this->shouldUseElasticSearchEngine()) { | ||||
return; | return; | ||||
} | } | ||||
$engine = new PhabricatorElasticSearchEngine(); | $engine = new PhabricatorElasticFulltextStorageEngine(); | ||||
$index_exists = null; | $index_exists = null; | ||||
$index_sane = null; | $index_sane = null; | ||||
try { | try { | ||||
$index_exists = $engine->indexExists(); | $index_exists = $engine->indexExists(); | ||||
if ($index_exists) { | if ($index_exists) { | ||||
$index_sane = $engine->indexIsSane(); | $index_sane = $engine->indexIsSane(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | if (!$index_exists) { | ||||
->newIssue('elastic.broken-index') | ->newIssue('elastic.broken-index') | ||||
->setName(pht('Elasticsearch index Incorrect')) | ->setName(pht('Elasticsearch index Incorrect')) | ||||
->setSummary($summary) | ->setSummary($summary) | ||||
->setMessage($message); | ->setMessage($message); | ||||
} | } | ||||
} | } | ||||
protected function shouldUseElasticSearchEngine() { | protected function shouldUseElasticSearchEngine() { | ||||
$search_engine = PhabricatorSearchEngine::loadEngine(); | $search_engine = PhabricatorFulltextStorageEngine::loadEngine(); | ||||
return ($search_engine instanceof PhabricatorElasticSearchEngine); | return ($search_engine instanceof PhabricatorElasticFulltextStorageEngine); | ||||
} | } | ||||
} | } |