Merge pull request #57 from firebrandhq/add-php7.2-ss37-support

Ensure compatibility with SS 3.7 & PHP 7.2
This commit is contained in:
Robbie Averill 2018-10-29 08:39:38 +00:00 committed by GitHub
commit 4ea39828c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

5
_config.php Normal file → Executable file
View File

@ -19,3 +19,8 @@
// EnvironmentCheckSuite::register('check', 'FileWriteableCheck("assets")', "Is assets/ writeable?"); // EnvironmentCheckSuite::register('check', 'FileWriteableCheck("assets")', "Is assets/ writeable?");
// EnvironmentCheckSuite::register('check', 'FileWriteableCheck("' . TEMP_FOLDER . '")', "Is the temp folder writeable?"); // EnvironmentCheckSuite::register('check', 'FileWriteableCheck("' . TEMP_FOLDER . '")', "Is the temp folder writeable?");
// Ensure compatibility with PHP 7.2 ("object" is a reserved word),
// with SilverStripe 3.6 (using Object) and SilverStripe 3.7 (using SS_Object)
if (!class_exists('SS_Object')) {
class_alias('Object', 'SS_Object');
}

4
code/EnvironmentCheckSuite.php Normal file → Executable file
View File

@ -19,7 +19,7 @@
* *
* $result = EnvironmentCheckSuite::inst('health')->run(); * $result = EnvironmentCheckSuite::inst('health')->run();
*/ */
class EnvironmentCheckSuite extends Object class EnvironmentCheckSuite extends SS_Object
{ {
/** /**
* Name of this suite. * Name of this suite.
@ -121,7 +121,7 @@ class EnvironmentCheckSuite extends Object
foreach ($this->checks as $check) { foreach ($this->checks as $check) {
list($checkClass, $checkTitle) = $check; list($checkClass, $checkTitle) = $check;
if (is_string($checkClass)) { if (is_string($checkClass)) {
$checkInst = Object::create_from_string($checkClass); $checkInst = SS_Object::create_from_string($checkClass);
if ($checkInst instanceof EnvironmentCheck) { if ($checkInst instanceof EnvironmentCheck) {
$output[] = array($checkInst, $checkTitle); $output[] = array($checkInst, $checkTitle);
} else { } else {