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
2bdb5f80
Commit
2bdb5f80
authored
May 11, 2013
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"YiiRequirementChecker::render()" has been implemented, console view has been created.
parent
f82a01e4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
2 deletions
+92
-2
YiiRequirementChecker.php
yii/requirements/YiiRequirementChecker.php
+35
-2
index.php
yii/requirements/views/console/index.php
+57
-0
No files found.
yii/requirements/YiiRequirementChecker.php
View file @
2bdb5f80
...
...
@@ -78,10 +78,43 @@ class YiiRequirementChecker
*/
function
render
()
{
if
(
isset
(
$this
->
result
))
{
if
(
!
isset
(
$this
->
result
))
{
$this
->
usageError
(
'Nothing to render!'
);
}
// @todo render
$baseViewFilePath
=
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'views'
;
if
(
array_key_exists
(
'argv'
,
$_SERVER
))
{
$viewFileName
=
$baseViewFilePath
.
DIRECTORY_SEPARATOR
.
'console'
.
DIRECTORY_SEPARATOR
.
'index.php'
;
}
else
{
$viewFileName
=
$baseViewFilePath
.
DIRECTORY_SEPARATOR
.
'web'
.
DIRECTORY_SEPARATOR
.
'index.php'
;
}
$this
->
renderViewFile
(
$viewFileName
,
$this
->
result
);
}
/**
* Renders a view file.
* This method includes the view file as a PHP script
* and captures the display result if required.
* @param string $_viewFile_ view file
* @param array $_data_ data to be extracted and made available to the view file
* @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.
*/
function
renderViewFile
(
$_viewFile_
,
$_data_
=
null
,
$_return_
=
false
)
{
// we use special variable names here to avoid conflict when extracting data
if
(
is_array
(
$_data_
))
{
extract
(
$_data_
,
EXTR_PREFIX_SAME
,
'data'
);
}
else
{
$data
=
$_data_
;
}
if
(
$_return_
)
{
ob_start
();
ob_implicit_flush
(
false
);
require
(
$_viewFile_
);
return
ob_get_clean
();
}
else
{
require
(
$_viewFile_
);
}
}
/**
...
...
yii/requirements/views/console/index.php
0 → 100644
View file @
2bdb5f80
<?php
/* @var $this YiiRequirementChecker */
/* @var $summary array */
/* @var $requirements array[] */
echo
"
\n
Yii Application Requirement Checker
\n\n
"
;
echo
"This script checks if your server configuration meets the requirements
\n
"
;
echo
"for running Yii application.
\n
"
;
echo
"It checks if the server is running the right version of PHP,
\n
"
;
echo
"if appropriate PHP extensions have been loaded, and if php.ini file settings are correct.
\n
"
;
echo
"
\n
Conclusion:
\n
"
;
$columnSizes
=
array
(
'name'
=>
25
,
'condition'
=>
10
,
'by'
=>
30
,
'memo'
=>
50
,
);
// Headers:
$tableLength
=
count
(
$columnSizes
)
+
1
;
foreach
(
$columnSizes
as
$columnSize
)
{
$tableLength
+=
$columnSize
;
}
echo
str_pad
(
''
,
$tableLength
,
'-'
);
echo
"
\n
"
;
echo
'|'
.
str_pad
(
'Name'
,
$columnSizes
[
'name'
],
' '
,
STR_PAD_BOTH
)
.
'|'
;
echo
str_pad
(
'Result'
,
$columnSizes
[
'condition'
],
' '
,
STR_PAD_BOTH
)
.
'|'
;
echo
str_pad
(
'Required By'
,
$columnSizes
[
'by'
],
' '
,
STR_PAD_BOTH
)
.
'|'
;
echo
str_pad
(
'Memo'
,
$columnSizes
[
'memo'
],
' '
,
STR_PAD_BOTH
)
.
'|'
;
echo
"
\n
"
;
echo
str_pad
(
''
,
$tableLength
,
'-'
);
echo
"
\n
"
;
// Rows:
foreach
(
$requirements
as
$requirement
)
{
$name
=
$requirement
[
'name'
];
echo
'|'
.
str_pad
(
' '
.
$name
,
$columnSizes
[
'name'
],
' '
,
STR_PAD_RIGHT
)
.
'|'
;
$condition
=
$requirement
[
'condition'
]
?
'Passed'
:
(
$requirement
[
'mandatory'
]
?
'FAILED'
:
'WARNING'
);
echo
str_pad
(
$condition
,
$columnSizes
[
'condition'
],
' '
,
STR_PAD_BOTH
)
.
'|'
;
$by
=
strip_tags
(
$requirement
[
'by'
]);
echo
str_pad
(
$by
,
$columnSizes
[
'by'
],
' '
,
STR_PAD_BOTH
)
.
'|'
;
$memo
=
strip_tags
(
$requirement
[
'memo'
]);
echo
str_pad
(
' '
.
$memo
,
$columnSizes
[
'memo'
],
' '
,
STR_PAD_RIGHT
)
.
'|'
;
echo
"
\n
"
;
}
echo
str_pad
(
''
,
$tableLength
,
'-'
);
echo
"
\n
"
;
// Summary
$summaryString
=
'Errors: '
.
$summary
[
'errors'
]
.
' Warnings: '
.
$summary
[
'warnings'
]
.
' Total checks: '
.
$summary
[
'total'
];
echo
$summaryString
;
echo
"
\n\n
"
;
\ No newline at end of file
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