| Conditions | 5 |
| Paths | 7 |
| Total Lines | 29 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function check() |
||
| 24 | { |
||
| 25 | $brokenCores = []; |
||
| 26 | |||
| 27 | if (!class_exists(Solr::class)) { |
||
| 28 | return [ |
||
| 29 | EnvironmentCheck::ERROR, |
||
| 30 | 'Class `' . Solr::class . '` not found. Is the fulltextsearch module installed?' |
||
| 31 | ]; |
||
| 32 | } |
||
| 33 | |||
| 34 | $service = Solr::service(); |
||
| 35 | foreach (Solr::get_indexes() as $index) { |
||
| 36 | /** @var SolrIndex $core */ |
||
| 37 | $core = $index->getIndexName(); |
||
| 38 | if (!$service->coreIsActive($core)) { |
||
| 39 | $brokenCores[] = $core; |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | if (!empty($brokenCores)) { |
||
| 44 | return [ |
||
| 45 | EnvironmentCheck::ERROR, |
||
| 46 | 'The following indexes are unavailable: ' . implode($brokenCores, ', ') |
||
| 47 | ]; |
||
| 48 | } |
||
| 49 | |||
| 50 | return [EnvironmentCheck::OK, 'Expected indexes are available.']; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |