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', '<')) {
* ~~~php
* require_once('path/to/YiiRequirementChecker.php');
* $requirementsChecker = new YiiRequirementChecker();
* $requirements =
[
*
[
* $requirements =
array(
*
array(
* 'name' => 'PHP Some Extension',
* 'mandatory' => true,
* 'condition' => extension_loaded('some_extension'),
* 'by' => 'Some application feature',
* 'memo' => 'PHP extension "some_extension" required',
*
]
,
*
]
;
*
)
,
*
)
;
* $requirementsChecker->checkYii()->check($requirements)->render();
* ~~~
*
...
...
@@ -38,12 +38,12 @@ if (version_compare(PHP_VERSION, '4.3', '<')) {
* For example:
*
* ~~~
* $requirements =
[
*
[
* $requirements =
array(
*
array(
* 'name' => 'Upload max file size',
* 'condition' => 'eval:$this->checkUploadMaxFileSize("5M")',
*
]
,
*
]
;
*
)
,
*
)
;
* ~~~
*
* Note: this class definition does not match ordinary Yii style, because it should match PHP 4.3
...
...
@@ -74,14 +74,14 @@ class YiiRequirementChecker
$this
->
usageError
(
'Requirements must be an array, "'
.
gettype
(
$requirements
)
.
'" has been given!'
);
}
if
(
!
isset
(
$this
->
result
)
||
!
is_array
(
$this
->
result
))
{
$this
->
result
=
[
'summary'
=>
[
$this
->
result
=
array
(
'summary'
=>
array
(
'total'
=>
0
,
'errors'
=>
0
,
'warnings'
=>
0
,
]
,
'requirements'
=>
[]
,
]
;
)
,
'requirements'
=>
array
()
,
)
;
}
foreach
(
$requirements
as
$key
=>
$rawRequirement
)
{
$requirement
=
$this
->
normalizeRequirement
(
$rawRequirement
,
$key
);
...
...
@@ -118,21 +118,21 @@ class YiiRequirementChecker
* Return the check results.
* @return array|null check results in format:
* <code>
*
[
* 'summary' =>
[
*
array(
* 'summary' =>
array(
* 'total' => total number of checks,
* 'errors' => number of errors,
* 'warnings' => number of warnings,
*
]
,
* 'requirements' =>
[
*
[
*
)
,
* 'requirements' =>
array(
*
array(
* ...
* 'error' => is there an error,
* 'warning' => is there a warning,
*
]
,
*
)
,
* ...
*
]
,
*
]
*
)
,
*
)
* </code>
*/
function
getResult
()
...
...
framework/yii/requirements/requirements.php
View file @
28aa4515
<?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.
*
* @var $this YiiRequirementChecker
*/
return
[
[
return
array
(
array
(
'name'
=>
'PHP version'
,
'mandatory'
=>
true
,
'condition'
=>
version_compare
(
PHP_VERSION
,
'5.4.0'
,
'>='
),
'by'
=>
'<a href="http://www.yiiframework.com">Yii Framework</a>'
,
'memo'
=>
'PHP 5.4.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.'
]
,
[
)
,
array
(
'name'
=>
'Intl extension'
,
'mandatory'
=>
false
,
'condition'
=>
$this
->
checkPhpExtensionVersion
(
'intl'
,
'1.0.2'
,
'>='
),
...
...
@@ -46,5 +46,5 @@ return [
'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
<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 @@
<table
class=
"table table-bordered"
>
<tr><th>
Name
</th><th>
Result
</th><th>
Required By
</th><th>
Memo
</th></tr>
<?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>
<?
=
$requirement
[
'name'
]
?>
<?
php
echo
$requirement
[
'name'
]
?>
</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>
<?
=
$requirement
[
'by'
]
?>
<?
php
echo
$requirement
[
'by'
]
?>
</td>
<td>
<?
=
$requirement
[
'memo'
]
?>
<?
php
echo
$requirement
[
'memo'
]
?>
</td>
</tr>
<?php
endforeach
;
?>
...
...
@@ -74,7 +74,7 @@
<hr>
<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>
</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