diff --git a/yii/requirements/YiiRequirementChecker.php b/yii/requirements/YiiRequirementChecker.php
index b8997bd..b63d1aa 100644
--- a/yii/requirements/YiiRequirementChecker.php
+++ b/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.
*/
diff --git a/yii/requirements/yiirequirements.php b/yii/requirements/yiirequirements.php
new file mode 100644
index 0000000..2c6f4d8
--- /dev/null
+++ b/yii/requirements/yiirequirements.php
@@ -0,0 +1,38 @@
+ 'PHP version',
+ 'mandatory' => true,
+ 'condition' => version_compare(PHP_VERSION, '5.3.0', '>='),
+ 'by' => 'Yii Framework',
+ 'memo' => 'PHP 5.3.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.'
+ ),
+);
\ No newline at end of file