Commit 64997fd5 by Carsten Brandt

fixed requirements checker once again...

parent 3a8945f8
...@@ -65,7 +65,7 @@ class YiiRequirementChecker ...@@ -65,7 +65,7 @@ class YiiRequirementChecker
* If a string, it is treated as the path of the file, which contains the requirements; * If a string, it is treated as the path of the file, which contains the requirements;
* @return static self instance. * @return static self instance.
*/ */
public function check($requirements) function check($requirements)
{ {
if (is_string($requirements)) { if (is_string($requirements)) {
$requirements = require($requirements); $requirements = require($requirements);
...@@ -110,7 +110,7 @@ class YiiRequirementChecker ...@@ -110,7 +110,7 @@ class YiiRequirementChecker
* Performs the check for the Yii core requirements. * Performs the check for the Yii core requirements.
* @return YiiRequirementChecker self instance. * @return YiiRequirementChecker self instance.
*/ */
public function checkYii() function checkYii()
{ {
return $this->check(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'requirements.php'); return $this->check(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'requirements.php');
} }
...@@ -137,7 +137,7 @@ class YiiRequirementChecker ...@@ -137,7 +137,7 @@ class YiiRequirementChecker
* ) * )
* ``` * ```
*/ */
public function getResult() function getResult()
{ {
if (isset($this->result)) { if (isset($this->result)) {
return $this->result; return $this->result;
...@@ -150,7 +150,7 @@ class YiiRequirementChecker ...@@ -150,7 +150,7 @@ class YiiRequirementChecker
* Renders the requirements check result. * Renders the requirements check result.
* The output will vary depending is a script running from web or from console. * The output will vary depending is a script running from web or from console.
*/ */
public function render() function render()
{ {
if (!isset($this->result)) { if (!isset($this->result)) {
$this->usageError('Nothing to render!'); $this->usageError('Nothing to render!');
...@@ -171,7 +171,7 @@ class YiiRequirementChecker ...@@ -171,7 +171,7 @@ class YiiRequirementChecker
* @param string $compare comparison operator, by default '>=' * @param string $compare comparison operator, by default '>='
* @return boolean if PHP extension version matches. * @return boolean if PHP extension version matches.
*/ */
public function checkPhpExtensionVersion($extensionName, $version, $compare = '>=') function checkPhpExtensionVersion($extensionName, $version, $compare = '>=')
{ {
if (!extension_loaded($extensionName)) { if (!extension_loaded($extensionName)) {
return false; return false;
...@@ -192,7 +192,7 @@ class YiiRequirementChecker ...@@ -192,7 +192,7 @@ class YiiRequirementChecker
* @param string $name configuration option name. * @param string $name configuration option name.
* @return boolean option is on. * @return boolean option is on.
*/ */
public function checkPhpIniOn($name) function checkPhpIniOn($name)
{ {
$value = ini_get($name); $value = ini_get($name);
if (empty($value)) { if (empty($value)) {
...@@ -207,7 +207,7 @@ class YiiRequirementChecker ...@@ -207,7 +207,7 @@ class YiiRequirementChecker
* @param string $name configuration option name. * @param string $name configuration option name.
* @return boolean option is off. * @return boolean option is off.
*/ */
public function checkPhpIniOff($name) function checkPhpIniOff($name)
{ {
$value = ini_get($name); $value = ini_get($name);
if (empty($value)) { if (empty($value)) {
...@@ -225,7 +225,7 @@ class YiiRequirementChecker ...@@ -225,7 +225,7 @@ class YiiRequirementChecker
* @param string $compare comparison operator, by default '>='. * @param string $compare comparison operator, by default '>='.
* @return boolean comparison result. * @return boolean comparison result.
*/ */
public function compareByteSize($a, $b, $compare = '>=') function compareByteSize($a, $b, $compare = '>=')
{ {
$compareExpression = '(' . $this->getByteSize($a) . $compare . $this->getByteSize($b) . ')'; $compareExpression = '(' . $this->getByteSize($a) . $compare . $this->getByteSize($b) . ')';
...@@ -238,7 +238,7 @@ class YiiRequirementChecker ...@@ -238,7 +238,7 @@ class YiiRequirementChecker
* @param string $verboseSize verbose size representation. * @param string $verboseSize verbose size representation.
* @return integer actual size in bytes. * @return integer actual size in bytes.
*/ */
public function getByteSize($verboseSize) function getByteSize($verboseSize)
{ {
if (empty($verboseSize)) { if (empty($verboseSize)) {
return 0; return 0;
...@@ -277,7 +277,7 @@ class YiiRequirementChecker ...@@ -277,7 +277,7 @@ class YiiRequirementChecker
* @param string|null $max verbose file size maximum required value, pass null to skip maximum check. * @param string|null $max verbose file size maximum required value, pass null to skip maximum check.
* @return boolean success. * @return boolean success.
*/ */
public function checkUploadMaxFileSize($min = null, $max = null) function checkUploadMaxFileSize($min = null, $max = null)
{ {
$postMaxSize = ini_get('post_max_size'); $postMaxSize = ini_get('post_max_size');
$uploadMaxFileSize = ini_get('upload_max_filesize'); $uploadMaxFileSize = ini_get('upload_max_filesize');
...@@ -305,7 +305,7 @@ class YiiRequirementChecker ...@@ -305,7 +305,7 @@ class YiiRequirementChecker
* @param boolean $_return_ whether the rendering result should be returned as a string * @param boolean $_return_ whether the rendering result should be returned as a string
* @return string the rendering result. Null if the rendering result is not required. * @return string the rendering result. Null if the rendering result is not required.
*/ */
public function renderViewFile($_viewFile_, $_data_ = null, $_return_ = false) function renderViewFile($_viewFile_, $_data_ = null, $_return_ = false)
{ {
// we use special variable names here to avoid conflict when extracting data // we use special variable names here to avoid conflict when extracting data
if (is_array($_data_)) { if (is_array($_data_)) {
...@@ -330,7 +330,7 @@ class YiiRequirementChecker ...@@ -330,7 +330,7 @@ class YiiRequirementChecker
* @param integer $requirementKey requirement key in the list. * @param integer $requirementKey requirement key in the list.
* @return array normalized requirement. * @return array normalized requirement.
*/ */
public function normalizeRequirement($requirement, $requirementKey = 0) function normalizeRequirement($requirement, $requirementKey = 0)
{ {
if (!is_array($requirement)) { if (!is_array($requirement)) {
$this->usageError('Requirement must be an array!'); $this->usageError('Requirement must be an array!');
...@@ -369,7 +369,7 @@ class YiiRequirementChecker ...@@ -369,7 +369,7 @@ class YiiRequirementChecker
* This method will then terminate the execution of the current application. * This method will then terminate the execution of the current application.
* @param string $message the error message * @param string $message the error message
*/ */
public function usageError($message) function usageError($message)
{ {
echo "Error: $message\n\n"; echo "Error: $message\n\n";
exit(1); exit(1);
...@@ -380,7 +380,7 @@ class YiiRequirementChecker ...@@ -380,7 +380,7 @@ class YiiRequirementChecker
* @param string $expression a PHP expression to be evaluated. * @param string $expression a PHP expression to be evaluated.
* @return mixed the expression result. * @return mixed the expression result.
*/ */
public function evaluateExpression($expression) function evaluateExpression($expression)
{ {
return eval('return ' . $expression . ';'); return eval('return ' . $expression . ';');
} }
...@@ -389,7 +389,7 @@ class YiiRequirementChecker ...@@ -389,7 +389,7 @@ class YiiRequirementChecker
* Returns the server information. * Returns the server information.
* @return string server information. * @return string server information.
*/ */
public function getServerInfo() function getServerInfo()
{ {
$info = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : ''; $info = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '';
...@@ -400,7 +400,7 @@ class YiiRequirementChecker ...@@ -400,7 +400,7 @@ class YiiRequirementChecker
* Returns the now date if possible in string representation. * Returns the now date if possible in string representation.
* @return string now date. * @return string now date.
*/ */
public function getNowDate() function getNowDate()
{ {
$nowDate = @strftime('%Y-%m-%d %H:%M', time()); $nowDate = @strftime('%Y-%m-%d %H:%M', time());
......
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