indexClass = $indexClass; } /** * {@inheritDoc} * * @return array */ public function check() { $brokenCores = []; /** * @todo Revisit this when silverstripe/fulltextsearch has 4.x compat */ if (!class_exists('\\Solr')) { return [ EnvironmentCheck::ERROR, 'Class `Solr` not found. Is the fulltextsearch module installed?' ]; } $service = \Solr::service(); foreach (\Solr::get_indexes($this->indexClass) as $index) { $core = $index->getIndexName(); if (!$service->coreIsActive($core)) { $brokenCores[] = $core; } } if (!empty($brokenCores)) { return [ EnvironmentCheck::ERROR, 'The following indexes are unavailable: ' . implode($brokenCores, ', ') ]; } return [EnvironmentCheck::OK, 'Expected indexes are available.']; } }