1 | <?php |
||||
2 | |||||
3 | namespace SilverStripe\EnvironmentCheck\Checks; |
||||
4 | |||||
5 | use SilverStripe\EnvironmentCheck\EnvironmentCheck; |
||||
6 | use SilverStripe\FullTextSearch\Solr\Solr; |
||||
0 ignored issues
–
show
|
|||||
7 | use SilverStripe\FullTextSearch\Solr\SolrIndex; |
||||
0 ignored issues
–
show
The type
SilverStripe\FullTextSearch\Solr\SolrIndex was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
8 | |||||
9 | /** |
||||
10 | * Check the availability of all Solr indexes |
||||
11 | * |
||||
12 | * If there are no indexes of given class found, the returned status will still be "OK". |
||||
13 | * |
||||
14 | * @package environmentcheck |
||||
15 | */ |
||||
16 | class SolrIndexCheck implements EnvironmentCheck |
||||
17 | { |
||||
18 | /** |
||||
19 | * {@inheritDoc} |
||||
20 | * |
||||
21 | * @return array |
||||
22 | */ |
||||
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, ', ') |
||||
0 ignored issues
–
show
The call to
implode() has too many arguments starting with ', ' .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
47 | ]; |
||||
48 | } |
||||
49 | |||||
50 | return [EnvironmentCheck::OK, 'Expected indexes are available.']; |
||||
51 | } |
||||
52 | } |
||||
53 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths