mirror of
https://github.com/silverstripe/silverstripe-environmentcheck
synced 2024-10-22 17:05:40 +02:00
Merge branch '3' into 4
This commit is contained in:
commit
cfefa51327
@ -80,7 +80,7 @@ class FileAccessibilityAndValidationCheck implements EnvironmentCheck
|
||||
{
|
||||
$this->path = $path;
|
||||
$this->fileTypeValidateFunc = ($fileTypeValidateFunc)? $fileTypeValidateFunc : 'noVidation';
|
||||
$this->checkType = ($checkType) ? $checkType : self::CHECK_SINGLE;
|
||||
$this->checkType = ($checkType) ? $checkType : FileAccessibilityAndValidationCheck::CHECK_SINGLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +109,9 @@ class FileAccessibilityAndValidationCheck implements EnvironmentCheck
|
||||
}
|
||||
|
||||
// If at least one file was valid, count as passed
|
||||
if ($this->checkType == self::CHECK_SINGLE && count($invalidFiles ?? []) < count($files ?? [])) {
|
||||
if ($this->checkType == FileAccessibilityAndValidationCheck::CHECK_SINGLE
|
||||
&& count($invalidFiles ?? []) < count($files ?? [])
|
||||
) {
|
||||
$validFileList = PHP_EOL;
|
||||
foreach ($validFiles as $vf) {
|
||||
$validFileList .= $vf . PHP_EOL;
|
||||
|
@ -85,7 +85,7 @@ class FileAgeCheck implements EnvironmentCheck
|
||||
$this->path = $path;
|
||||
$this->relativeAge = $relativeAge;
|
||||
$this->checkFn = $checkFn;
|
||||
$this->checkType = ($checkType) ? $checkType : self::CHECK_SINGLE;
|
||||
$this->checkType = ($checkType) ? $checkType : FileAgeCheck::CHECK_SINGLE;
|
||||
$this->compareOperand = $compareOperand;
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ class FileAgeCheck implements EnvironmentCheck
|
||||
$validFiles[] = $file;
|
||||
} else {
|
||||
$invalidFiles[] = $file;
|
||||
if ($this->checkType == self::CHECK_ALL) {
|
||||
if ($this->checkType == FileAgeCheck::CHECK_ALL) {
|
||||
return [
|
||||
EnvironmentCheck::ERROR,
|
||||
sprintf(
|
||||
@ -127,7 +127,7 @@ class FileAgeCheck implements EnvironmentCheck
|
||||
}
|
||||
|
||||
// If at least one file was valid, count as passed
|
||||
if ($this->checkType == self::CHECK_SINGLE && count($invalidFiles ?? []) < count($files ?? [])) {
|
||||
if ($this->checkType == FileAgeCheck::CHECK_SINGLE && count($invalidFiles ?? []) < count($files ?? [])) {
|
||||
return [EnvironmentCheck::OK, ''];
|
||||
}
|
||||
if (count($invalidFiles ?? []) == 0) {
|
||||
|
@ -74,7 +74,8 @@ class EnvironmentCheckSuite
|
||||
public function __construct($suiteName)
|
||||
{
|
||||
if (empty($this->config()->registered_suites[$suiteName])) {
|
||||
// Not registered via config system, but it still may be configured later via self::register.
|
||||
// Not registered via config system, but it still may be configured later
|
||||
// via EnvironmentCheckSuite::register.
|
||||
return;
|
||||
}
|
||||
|
||||
@ -181,10 +182,10 @@ class EnvironmentCheckSuite
|
||||
*/
|
||||
public static function inst($name)
|
||||
{
|
||||
if (!isset(self::$instances[$name])) {
|
||||
self::$instances[$name] = new EnvironmentCheckSuite($name);
|
||||
if (!isset(EnvironmentCheckSuite::$instances[$name])) {
|
||||
EnvironmentCheckSuite::$instances[$name] = new EnvironmentCheckSuite($name);
|
||||
}
|
||||
return self::$instances[$name];
|
||||
return EnvironmentCheckSuite::$instances[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -201,7 +202,7 @@ class EnvironmentCheckSuite
|
||||
}
|
||||
|
||||
foreach ($names as $name) {
|
||||
self::inst($name)->push($check, $title);
|
||||
EnvironmentCheckSuite::inst($name)->push($check, $title);
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,6 +211,6 @@ class EnvironmentCheckSuite
|
||||
*/
|
||||
public static function reset()
|
||||
{
|
||||
self::$instances = [];
|
||||
EnvironmentCheckSuite::$instances = [];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user