Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
28aa4515
Commit
28aa4515
authored
Oct 24, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reverted 5.4 enhancements on requirements checked to be able to run it on lower PHP versions
parent
8c98d995
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
42 deletions
+42
-42
YiiRequirementChecker.php
framework/yii/requirements/YiiRequirementChecker.php
+21
-21
requirements.php
framework/yii/requirements/requirements.php
+15
-15
index.php
framework/yii/requirements/views/web/index.php
+6
-6
No files found.
framework/yii/requirements/YiiRequirementChecker.php
View file @
28aa4515
...
@@ -19,15 +19,15 @@ if (version_compare(PHP_VERSION, '4.3', '<')) {
...
@@ -19,15 +19,15 @@ if (version_compare(PHP_VERSION, '4.3', '<')) {
* ~~~php
* ~~~php
* require_once('path/to/YiiRequirementChecker.php');
* require_once('path/to/YiiRequirementChecker.php');
* $requirementsChecker = new YiiRequirementChecker();
* $requirementsChecker = new YiiRequirementChecker();
* $requirements =
[
* $requirements =
array(
*
[
*
array(
* 'name' => 'PHP Some Extension',
* 'name' => 'PHP Some Extension',
* 'mandatory' => true,
* 'mandatory' => true,
* 'condition' => extension_loaded('some_extension'),
* 'condition' => extension_loaded('some_extension'),
* 'by' => 'Some application feature',
* 'by' => 'Some application feature',
* 'memo' => 'PHP extension "some_extension" required',
* 'memo' => 'PHP extension "some_extension" required',
*
]
,
*
)
,
*
]
;
*
)
;
* $requirementsChecker->checkYii()->check($requirements)->render();
* $requirementsChecker->checkYii()->check($requirements)->render();
* ~~~
* ~~~
*
*
...
@@ -38,12 +38,12 @@ if (version_compare(PHP_VERSION, '4.3', '<')) {
...
@@ -38,12 +38,12 @@ if (version_compare(PHP_VERSION, '4.3', '<')) {
* For example:
* For example:
*
*
* ~~~
* ~~~
* $requirements =
[
* $requirements =
array(
*
[
*
array(
* 'name' => 'Upload max file size',
* 'name' => 'Upload max file size',
* 'condition' => 'eval:$this->checkUploadMaxFileSize("5M")',
* 'condition' => 'eval:$this->checkUploadMaxFileSize("5M")',
*
]
,
*
)
,
*
]
;
*
)
;
* ~~~
* ~~~
*
*
* Note: this class definition does not match ordinary Yii style, because it should match PHP 4.3
* Note: this class definition does not match ordinary Yii style, because it should match PHP 4.3
...
@@ -74,14 +74,14 @@ class YiiRequirementChecker
...
@@ -74,14 +74,14 @@ class YiiRequirementChecker
$this
->
usageError
(
'Requirements must be an array, "'
.
gettype
(
$requirements
)
.
'" has been given!'
);
$this
->
usageError
(
'Requirements must be an array, "'
.
gettype
(
$requirements
)
.
'" has been given!'
);
}
}
if
(
!
isset
(
$this
->
result
)
||
!
is_array
(
$this
->
result
))
{
if
(
!
isset
(
$this
->
result
)
||
!
is_array
(
$this
->
result
))
{
$this
->
result
=
[
$this
->
result
=
array
(
'summary'
=>
[
'summary'
=>
array
(
'total'
=>
0
,
'total'
=>
0
,
'errors'
=>
0
,
'errors'
=>
0
,
'warnings'
=>
0
,
'warnings'
=>
0
,
]
,
)
,
'requirements'
=>
[]
,
'requirements'
=>
array
()
,
]
;
)
;
}
}
foreach
(
$requirements
as
$key
=>
$rawRequirement
)
{
foreach
(
$requirements
as
$key
=>
$rawRequirement
)
{
$requirement
=
$this
->
normalizeRequirement
(
$rawRequirement
,
$key
);
$requirement
=
$this
->
normalizeRequirement
(
$rawRequirement
,
$key
);
...
@@ -118,21 +118,21 @@ class YiiRequirementChecker
...
@@ -118,21 +118,21 @@ class YiiRequirementChecker
* Return the check results.
* Return the check results.
* @return array|null check results in format:
* @return array|null check results in format:
* <code>
* <code>
*
[
*
array(
* 'summary' =>
[
* 'summary' =>
array(
* 'total' => total number of checks,
* 'total' => total number of checks,
* 'errors' => number of errors,
* 'errors' => number of errors,
* 'warnings' => number of warnings,
* 'warnings' => number of warnings,
*
]
,
*
)
,
* 'requirements' =>
[
* 'requirements' =>
array(
*
[
*
array(
* ...
* ...
* 'error' => is there an error,
* 'error' => is there an error,
* 'warning' => is there a warning,
* 'warning' => is there a warning,
*
]
,
*
)
,
* ...
* ...
*
]
,
*
)
,
*
]
*
)
* </code>
* </code>
*/
*/
function
getResult
()
function
getResult
()
...
...
framework/yii/requirements/requirements.php
View file @
28aa4515
<?php
<?php
/**
/**
* These are the Yii core requirements for the
[[YiiRequirementChecker]]
instance.
* These are the Yii core requirements for the
array(array(YiiRequirementChecker))
instance.
* These requirements are mandatory for any Yii application.
* These requirements are mandatory for any Yii application.
*
*
* @var $this YiiRequirementChecker
* @var $this YiiRequirementChecker
*/
*/
return
[
return
array
(
[
array
(
'name'
=>
'PHP version'
,
'name'
=>
'PHP version'
,
'mandatory'
=>
true
,
'mandatory'
=>
true
,
'condition'
=>
version_compare
(
PHP_VERSION
,
'5.4.0'
,
'>='
),
'condition'
=>
version_compare
(
PHP_VERSION
,
'5.4.0'
,
'>='
),
'by'
=>
'<a href="http://www.yiiframework.com">Yii Framework</a>'
,
'by'
=>
'<a href="http://www.yiiframework.com">Yii Framework</a>'
,
'memo'
=>
'PHP 5.4.0 or higher is required.'
,
'memo'
=>
'PHP 5.4.0 or higher is required.'
,
]
,
)
,
[
array
(
'name'
=>
'Reflection extension'
,
'name'
=>
'Reflection extension'
,
'mandatory'
=>
true
,
'mandatory'
=>
true
,
'condition'
=>
class_exists
(
'Reflection'
,
false
),
'condition'
=>
class_exists
(
'Reflection'
,
false
),
'by'
=>
'<a href="http://www.yiiframework.com">Yii Framework</a>'
,
'by'
=>
'<a href="http://www.yiiframework.com">Yii Framework</a>'
,
]
,
)
,
[
array
(
'name'
=>
'PCRE extension'
,
'name'
=>
'PCRE extension'
,
'mandatory'
=>
true
,
'mandatory'
=>
true
,
'condition'
=>
extension_loaded
(
'pcre'
),
'condition'
=>
extension_loaded
(
'pcre'
),
'by'
=>
'<a href="http://www.yiiframework.com">Yii Framework</a>'
,
'by'
=>
'<a href="http://www.yiiframework.com">Yii Framework</a>'
,
]
,
)
,
[
array
(
'name'
=>
'SPL extension'
,
'name'
=>
'SPL extension'
,
'mandatory'
=>
true
,
'mandatory'
=>
true
,
'condition'
=>
extension_loaded
(
'SPL'
),
'condition'
=>
extension_loaded
(
'SPL'
),
'by'
=>
'<a href="http://www.yiiframework.com">Yii Framework</a>'
,
'by'
=>
'<a href="http://www.yiiframework.com">Yii Framework</a>'
,
]
,
)
,
[
array
(
'name'
=>
'MBString extension'
,
'name'
=>
'MBString extension'
,
'mandatory'
=>
true
,
'mandatory'
=>
true
,
'condition'
=>
extension_loaded
(
'mbstring'
),
'condition'
=>
extension_loaded
(
'mbstring'
),
'by'
=>
'<a href="http://www.php.net/manual/en/book.mbstring.php">Multibyte string</a> processing'
,
'by'
=>
'<a href="http://www.php.net/manual/en/book.mbstring.php">Multibyte string</a> processing'
,
'memo'
=>
'Required for multibyte encoding string processing.'
'memo'
=>
'Required for multibyte encoding string processing.'
]
,
)
,
[
array
(
'name'
=>
'Intl extension'
,
'name'
=>
'Intl extension'
,
'mandatory'
=>
false
,
'mandatory'
=>
false
,
'condition'
=>
$this
->
checkPhpExtensionVersion
(
'intl'
,
'1.0.2'
,
'>='
),
'condition'
=>
$this
->
checkPhpExtensionVersion
(
'intl'
,
'1.0.2'
,
'>='
),
...
@@ -46,5 +46,5 @@ return [
...
@@ -46,5 +46,5 @@ return [
'memo'
=>
'PHP Intl extension 1.0.2 or higher is required when you want to use advanced parameters formatting
'memo'
=>
'PHP Intl extension 1.0.2 or higher is required when you want to use advanced parameters formatting
in <code>\Yii::t()</code>, <abbr title="Internationalized domain names">IDN</abbr>-feature of
in <code>\Yii::t()</code>, <abbr title="Internationalized domain names">IDN</abbr>-feature of
<code>EmailValidator</code> or <code>UrlValidator</code> or the <code>yii\i18n\Formatter</code> class.'
<code>EmailValidator</code> or <code>UrlValidator</code> or the <code>yii\i18n\Formatter</code> class.'
]
,
)
,
]
;
)
;
framework/yii/requirements/views/web/index.php
View file @
28aa4515
...
@@ -52,18 +52,18 @@
...
@@ -52,18 +52,18 @@
<table
class=
"table table-bordered"
>
<table
class=
"table table-bordered"
>
<tr><th>
Name
</th><th>
Result
</th><th>
Required By
</th><th>
Memo
</th></tr>
<tr><th>
Name
</th><th>
Result
</th><th>
Required By
</th><th>
Memo
</th></tr>
<?php
foreach
(
$requirements
as
$requirement
)
:
?>
<?php
foreach
(
$requirements
as
$requirement
)
:
?>
<tr
class=
"
<?
=
$requirement
[
'condition'
]
?
'success'
:
(
$requirement
[
'mandatory'
]
?
'error'
:
'warning'
)
?>
"
>
<tr
class=
"
<?
php
echo
$requirement
[
'condition'
]
?
'success'
:
(
$requirement
[
'mandatory'
]
?
'error'
:
'warning'
)
?>
"
>
<td>
<td>
<?
=
$requirement
[
'name'
]
?>
<?
php
echo
$requirement
[
'name'
]
?>
</td>
</td>
<td>
<td>
<span
class=
"result"
>
<?
=
$requirement
[
'condition'
]
?
'Passed'
:
(
$requirement
[
'mandatory'
]
?
'Failed'
:
'Warning'
)
?>
</span>
<span
class=
"result"
>
<?
php
echo
$requirement
[
'condition'
]
?
'Passed'
:
(
$requirement
[
'mandatory'
]
?
'Failed'
:
'Warning'
)
?>
</span>
</td>
</td>
<td>
<td>
<?
=
$requirement
[
'by'
]
?>
<?
php
echo
$requirement
[
'by'
]
?>
</td>
</td>
<td>
<td>
<?
=
$requirement
[
'memo'
]
?>
<?
php
echo
$requirement
[
'memo'
]
?>
</td>
</td>
</tr>
</tr>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
<hr>
<hr>
<div
class=
"footer"
>
<div
class=
"footer"
>
<p>
Server:
<?
=
$this
->
getServerInfo
()
.
' '
.
$this
->
getNowDate
()
?>
</p>
<p>
Server:
<?
php
echo
$this
->
getServerInfo
()
.
' '
.
$this
->
getNowDate
()
?>
</p>
<p>
Powered by
<a
href=
"http://www.yiiframework.com/"
rel=
"external"
>
Yii Framework
</a></p>
<p>
Powered by
<a
href=
"http://www.yiiframework.com/"
rel=
"external"
>
Yii Framework
</a></p>
</div>
</div>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment