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
004d0b04
Commit
004d0b04
authored
May 21, 2013
by
Paul Klimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"YiiRequirementChecker" definition has been reverted to match PHP 4.3
parent
b2e7aa31
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
YiiRequirementChecker.php
yii/requirements/YiiRequirementChecker.php
+19
-16
No files found.
yii/requirements/YiiRequirementChecker.php
View file @
004d0b04
...
...
@@ -46,6 +46,9 @@ if (version_compare(PHP_VERSION, '4.3', '<')) {
* );
* ~~~
*
* Note: this class definition does not match ordinary Yii style, because it should match PHP 4.3
* and should not use features from the older PHP version!
*
* @property array|null $result the check results, this property is for internal usage only.
*
* @author Paul Klimov <klimov.paul@gmail.com>
...
...
@@ -62,7 +65,7 @@ class YiiRequirementChecker
* If a string, it is treated as the path of the file, which contains the requirements;
* @return YiiRequirementChecker self instance.
*/
public
function
check
(
$requirements
)
function
check
(
$requirements
)
{
if
(
is_string
(
$requirements
))
{
$requirements
=
require
(
$requirements
);
...
...
@@ -106,7 +109,7 @@ class YiiRequirementChecker
* Performs the check for the Yii core requirements.
* @return YiiRequirementChecker self instance.
*/
public
function
checkYii
()
function
checkYii
()
{
return
$this
->
check
(
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'requirements.php'
);
}
...
...
@@ -132,7 +135,7 @@ class YiiRequirementChecker
* )
* </code>
*/
public
function
getResult
()
function
getResult
()
{
if
(
isset
(
$this
->
result
))
{
return
$this
->
result
;
...
...
@@ -145,7 +148,7 @@ class YiiRequirementChecker
* Renders the requirements check result.
* The output will vary depending is a script running from web or from console.
*/
public
function
render
()
function
render
()
{
if
(
!
isset
(
$this
->
result
))
{
$this
->
usageError
(
'Nothing to render!'
);
...
...
@@ -166,7 +169,7 @@ class YiiRequirementChecker
* @param string $compare comparison operator, by default '>='
* @return boolean if PHP extension version matches.
*/
public
function
checkPhpExtensionVersion
(
$extensionName
,
$version
,
$compare
=
'>='
)
function
checkPhpExtensionVersion
(
$extensionName
,
$version
,
$compare
=
'>='
)
{
if
(
!
extension_loaded
(
$extensionName
))
{
return
false
;
...
...
@@ -183,7 +186,7 @@ class YiiRequirementChecker
* @param string $name configuration option name.
* @return boolean option is on.
*/
public
function
checkPhpIniOn
(
$name
)
function
checkPhpIniOn
(
$name
)
{
$value
=
ini_get
(
$name
);
if
(
empty
(
$value
))
{
...
...
@@ -197,7 +200,7 @@ class YiiRequirementChecker
* @param string $name configuration option name.
* @return boolean option is off.
*/
public
function
checkPhpIniOff
(
$name
)
function
checkPhpIniOff
(
$name
)
{
$value
=
ini_get
(
$name
);
if
(
empty
(
$value
))
{
...
...
@@ -214,7 +217,7 @@ class YiiRequirementChecker
* @param string $compare comparison operator, by default '>='.
* @return boolean comparison result.
*/
public
function
compareByteSize
(
$a
,
$b
,
$compare
=
'>='
)
function
compareByteSize
(
$a
,
$b
,
$compare
=
'>='
)
{
$compareExpression
=
'('
.
$this
->
getByteSize
(
$a
)
.
$compare
.
$this
->
getByteSize
(
$b
)
.
')'
;
return
$this
->
evaluateExpression
(
$compareExpression
);
...
...
@@ -226,7 +229,7 @@ class YiiRequirementChecker
* @param string $verboseSize verbose size representation.
* @return integer actual size in bytes.
*/
public
function
getByteSize
(
$verboseSize
)
function
getByteSize
(
$verboseSize
)
{
if
(
empty
(
$verboseSize
))
{
return
0
;
...
...
@@ -265,7 +268,7 @@ class YiiRequirementChecker
* @param string|null $max verbose file size maximum required value, pass null to skip maximum check.
* @return boolean success.
*/
public
function
checkUploadMaxFileSize
(
$min
=
null
,
$max
=
null
)
function
checkUploadMaxFileSize
(
$min
=
null
,
$max
=
null
)
{
$postMaxSize
=
ini_get
(
'post_max_size'
);
$uploadMaxFileSize
=
ini_get
(
'upload_max_filesize'
);
...
...
@@ -292,7 +295,7 @@ class YiiRequirementChecker
* @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.
*/
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
if
(
is_array
(
$_data_
))
{
...
...
@@ -316,7 +319,7 @@ class YiiRequirementChecker
* @param int $requirementKey requirement key in the list.
* @return array normalized requirement.
*/
public
function
normalizeRequirement
(
$requirement
,
$requirementKey
=
0
)
function
normalizeRequirement
(
$requirement
,
$requirementKey
=
0
)
{
if
(
!
is_array
(
$requirement
))
{
$this
->
usageError
(
'Requirement must be an array!'
);
...
...
@@ -354,7 +357,7 @@ class YiiRequirementChecker
* This method will then terminate the execution of the current application.
* @param string $message the error message
*/
public
function
usageError
(
$message
)
function
usageError
(
$message
)
{
echo
"Error:
$message
\n\n
"
;
exit
(
1
);
...
...
@@ -365,7 +368,7 @@ class YiiRequirementChecker
* @param string $expression a PHP expression to be evaluated.
* @return mixed the expression result.
*/
public
function
evaluateExpression
(
$expression
)
function
evaluateExpression
(
$expression
)
{
return
eval
(
'return '
.
$expression
.
';'
);
}
...
...
@@ -374,7 +377,7 @@ class YiiRequirementChecker
* Returns the server information.
* @return string server information.
*/
public
function
getServerInfo
()
function
getServerInfo
()
{
$info
=
isset
(
$_SERVER
[
'SERVER_SOFTWARE'
])
?
$_SERVER
[
'SERVER_SOFTWARE'
]
:
''
;
return
$info
;
...
...
@@ -384,7 +387,7 @@ class YiiRequirementChecker
* Returns the now date if possible in string representation.
* @return string now date.
*/
public
function
getNowDate
()
function
getNowDate
()
{
$nowDate
=
@
strftime
(
'%Y-%m-%d %H:%M'
,
time
());
return
$nowDate
;
...
...
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