Commit e0682294 by Klimov Paul

"YiiRequirementChecker::check()" has been updated allowing to accept filename for the requirements.

Yii core requirements file has been composed.
parent 9a461edd
...@@ -19,11 +19,16 @@ class YiiRequirementChecker ...@@ -19,11 +19,16 @@ class YiiRequirementChecker
* Check the given requirements, collecting results into internal field. * Check the given requirements, collecting results into internal field.
* This method can be invoked several times checking different requirement sets. * This method can be invoked several times checking different requirement sets.
* Use {@link getResult()} or {@link render()} to get the results. * Use {@link getResult()} or {@link render()} to get the results.
* @param array $requirements requirements to be checked. * @param array|string $requirements requirements to be checked.
* If an array, it is treated as the set of requirements;
* If a string, it is treated as the path of the file, which contains the requirements;
* @return YiiRequirementChecker self instance. * @return YiiRequirementChecker self instance.
*/ */
function check($requirements) function check($requirements)
{ {
if (is_string($requirements)) {
$requirements = require($requirements);
}
if (!is_array($requirements)) { if (!is_array($requirements)) {
$this->usageError("Requirements must be an array!"); $this->usageError("Requirements must be an array!");
} }
...@@ -60,6 +65,15 @@ class YiiRequirementChecker ...@@ -60,6 +65,15 @@ class YiiRequirementChecker
} }
/** /**
* Performs the check for the Yii core requirements.
* @return YiiRequirementChecker self instance.
*/
public function checkYii()
{
return $this->check(dirname(__FILE__).DIRECTORY_SEPARATOR.'yiirequirements.php');
}
/**
* Return the check results. * Return the check results.
* @return array|null check results. * @return array|null check results.
*/ */
......
<?php
/**
* This is the Yii core requirements for the {@link YiiRequirementChecker} instance.
*/
return array(
array(
'name' => 'PHP version',
'mandatory' => true,
'condition' => version_compare(PHP_VERSION, '5.3.0', '>='),
'by' => '<a href="http://www.yiiframework.com">Yii Framework</a>',
'memo' => 'PHP 5.3.0 or higher is required.',
),
array(
'name' => 'Reflection extension',
'mandatory' => true,
'condition' => class_exists('Reflection', false),
'by' => '<a href="http://www.yiiframework.com">Yii Framework</a>',
),
array(
'name' => 'PCRE extension',
'mandatory' => true,
'condition' => extension_loaded('pcre'),
'by' => '<a href="http://www.yiiframework.com">Yii Framework</a>',
),
array(
'name' => 'SPL extension',
'mandatory' => true,
'condition' => extension_loaded('SPL'),
'by' => '<a href="http://www.yiiframework.com">Yii Framework</a>',
),
array(
'name' => 'MBString extension',
'mandatory' => true,
'condition' => extension_loaded('mbstring'),
'by' => '<a href="http://www.php.net/manual/en/book.mbstring.php">Multibyte string</a> processing',
'memo' => 'Required for multibyte encoding string processing.'
),
);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment