From 28aa451557a0e3e80501f2a00c6f2871ca6fbb26 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 24 Oct 2013 17:40:42 +0400 Subject: [PATCH] Reverted 5.4 enhancements on requirements checked to be able to run it on lower PHP versions --- .../yii/requirements/YiiRequirementChecker.php | 42 +++++++++++----------- framework/yii/requirements/requirements.php | 30 ++++++++-------- framework/yii/requirements/views/web/index.php | 12 +++---- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/framework/yii/requirements/YiiRequirementChecker.php b/framework/yii/requirements/YiiRequirementChecker.php index 77e98d7..c8ad45d 100644 --- a/framework/yii/requirements/YiiRequirementChecker.php +++ b/framework/yii/requirements/YiiRequirementChecker.php @@ -19,15 +19,15 @@ if (version_compare(PHP_VERSION, '4.3', '<')) { * ~~~php * require_once('path/to/YiiRequirementChecker.php'); * $requirementsChecker = new YiiRequirementChecker(); - * $requirements = [ - * [ + * $requirements = array( + * array( * 'name' => 'PHP Some Extension', * 'mandatory' => true, * 'condition' => extension_loaded('some_extension'), * 'by' => 'Some application feature', * 'memo' => 'PHP extension "some_extension" required', - * ], - * ]; + * ), + * ); * $requirementsChecker->checkYii()->check($requirements)->render(); * ~~~ * @@ -38,12 +38,12 @@ if (version_compare(PHP_VERSION, '4.3', '<')) { * For example: * * ~~~ - * $requirements = [ - * [ + * $requirements = array( + * array( * 'name' => 'Upload max file size', * 'condition' => 'eval:$this->checkUploadMaxFileSize("5M")', - * ], - * ]; + * ), + * ); * ~~~ * * Note: this class definition does not match ordinary Yii style, because it should match PHP 4.3 @@ -74,14 +74,14 @@ class YiiRequirementChecker $this->usageError('Requirements must be an array, "' . gettype($requirements) . '" has been given!'); } if (!isset($this->result) || !is_array($this->result)) { - $this->result = [ - 'summary' => [ + $this->result = array( + 'summary' => array( 'total' => 0, 'errors' => 0, 'warnings' => 0, - ], - 'requirements' => [], - ]; + ), + 'requirements' => array(), + ); } foreach ($requirements as $key => $rawRequirement) { $requirement = $this->normalizeRequirement($rawRequirement, $key); @@ -118,21 +118,21 @@ class YiiRequirementChecker * Return the check results. * @return array|null check results in format: * - * [ - * 'summary' => [ + * array( + * 'summary' => array( * 'total' => total number of checks, * 'errors' => number of errors, * 'warnings' => number of warnings, - * ], - * 'requirements' => [ - * [ + * ), + * 'requirements' => array( + * array( * ... * 'error' => is there an error, * 'warning' => is there a warning, - * ], + * ), * ... - * ], - * ] + * ), + * ) * */ function getResult() diff --git a/framework/yii/requirements/requirements.php b/framework/yii/requirements/requirements.php index 9f9f582..c722aa9 100644 --- a/framework/yii/requirements/requirements.php +++ b/framework/yii/requirements/requirements.php @@ -1,44 +1,44 @@ 'PHP version', 'mandatory' => true, 'condition' => version_compare(PHP_VERSION, '5.4.0', '>='), 'by' => 'Yii Framework', 'memo' => 'PHP 5.4.0 or higher is required.', - ], - [ + ), + array( 'name' => 'Reflection extension', 'mandatory' => true, 'condition' => class_exists('Reflection', false), 'by' => 'Yii Framework', - ], - [ + ), + array( 'name' => 'PCRE extension', 'mandatory' => true, 'condition' => extension_loaded('pcre'), 'by' => 'Yii Framework', - ], - [ + ), + array( 'name' => 'SPL extension', 'mandatory' => true, 'condition' => extension_loaded('SPL'), 'by' => 'Yii Framework', - ], - [ + ), + array( 'name' => 'MBString extension', 'mandatory' => true, 'condition' => extension_loaded('mbstring'), 'by' => 'Multibyte string processing', 'memo' => 'Required for multibyte encoding string processing.' - ], - [ + ), + array( 'name' => 'Intl extension', 'mandatory' => false, 'condition' => $this->checkPhpExtensionVersion('intl', '1.0.2', '>='), @@ -46,5 +46,5 @@ return [ 'memo' => 'PHP Intl extension 1.0.2 or higher is required when you want to use advanced parameters formatting in \Yii::t(), IDN-feature of EmailValidator or UrlValidator or the yii\i18n\Formatter class.' - ], -]; + ), +); diff --git a/framework/yii/requirements/views/web/index.php b/framework/yii/requirements/views/web/index.php index 82e3fdb..c45ce11 100644 --- a/framework/yii/requirements/views/web/index.php +++ b/framework/yii/requirements/views/web/index.php @@ -52,18 +52,18 @@ - + @@ -74,7 +74,7 @@
NameResultRequired ByMemo
- + - + - + - +