sunnysideup /
silverstripe-health-check-provider
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Sunnysideup\HealthCheckProvider\Checks\Content; |
||
| 4 | |||
| 5 | use SilverStripe\CMS\Model\SiteTree; |
||
|
0 ignored issues
–
show
|
|||
| 6 | use SilverStripe\Core\ClassInfo; |
||
| 7 | use SilverStripe\Core\Injector\Injector; |
||
| 8 | use SilverStripe\ORM\DB; |
||
| 9 | use SilverStripe\Versioned\Versioned; |
||
|
0 ignored issues
–
show
The type
SilverStripe\Versioned\Versioned 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 Loading history...
|
|||
| 10 | use Sunnysideup\HealthCheckProvider\Checks\HealthCheckItemRunner; |
||
| 11 | |||
| 12 | class PagesOnSite extends HealthCheckItemRunner |
||
| 13 | { |
||
| 14 | private static $limit = 3; |
||
|
0 ignored issues
–
show
|
|||
| 15 | |||
| 16 | public function getCalculatedAnswer(): array |
||
| 17 | { |
||
| 18 | $pageTypes = ClassInfo::subclassesFor(SiteTree::class, false); |
||
| 19 | $array = []; |
||
| 20 | foreach ($pageTypes as $pageType) { |
||
| 21 | $pages = Versioned::get_by_stage( |
||
| 22 | $pageType, // class, |
||
| 23 | Versioned::LIVE, // stage, |
||
| 24 | '', // filter = '', |
||
| 25 | DB::get_conn()->random(), // sort = '', |
||
| 26 | '', // join = '', |
||
| 27 | $this->config()->get('limit') // limit |
||
| 28 | ); |
||
| 29 | |||
| 30 | $array[] = [ |
||
| 31 | 'Name' => Injector::inst()->get($pageType)->i18n_singular_name(), |
||
| 32 | 'Count' => $pageType::get()->count(), |
||
| 33 | 'Examples' => $this->turnPagesIntoArray($pages), |
||
| 34 | ]; |
||
| 35 | } |
||
| 36 | return $array; |
||
| 37 | } |
||
| 38 | |||
| 39 | protected function nameSpacesRequired(): array |
||
| 40 | { |
||
| 41 | return [ |
||
| 42 | 'SilverStripe\\Reports', |
||
| 43 | ]; |
||
| 44 | } |
||
| 45 | } |
||
| 46 |
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