Browse Source

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

Yii core requirements file has been composed.
tags/2.0.0-beta
Klimov Paul 12 years ago
parent
commit
e068229401
  1. 16
      yii/requirements/YiiRequirementChecker.php
  2. 38
      yii/requirements/yiirequirements.php

16
yii/requirements/YiiRequirementChecker.php

@ -19,11 +19,16 @@ class YiiRequirementChecker
* Check the given requirements, collecting results into internal field.
* This method can be invoked several times checking different requirement sets.
* 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.
*/
function check($requirements)
{
if (is_string($requirements)) {
$requirements = require($requirements);
}
if (!is_array($requirements)) {
$this->usageError("Requirements must be an array!");
}
@ -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 array|null check results.
*/

38
yii/requirements/yiirequirements.php

@ -0,0 +1,38 @@
<?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.'
),
);
Loading…
Cancel
Save