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
607294a4
Commit
607294a4
authored
Jun 24, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #2821: Console help command incorrectly lists non-console controllers as available commands
parent
bf599b96
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
HelpController.php
framework/console/controllers/HelpController.php
+19
-1
yii
framework/yii
+1
-0
No files found.
framework/CHANGELOG.md
View file @
607294a4
...
...
@@ -8,6 +8,7 @@ Yii Framework 2 Change Log
-
Bug #2314: Gii model generator does not generate correct relation type in some special case (qiangxue)
-
Bug #2563: Theming is not working if the path map of the theme contains ".." or "." in the paths (qiangxue)
-
Bug #2801: Fixed the issue that GridView gets footer content before data cells content (ElisDN)
-
Bug #2821: Console help command incorrectly lists non-console controllers as available commands (qiangxue)
-
Bug #2853: ActiveRecord did not handle resource-typed columns well (chris68, qiangxue)
-
Bug #3042:
`yii\widgets\Pjax`
should end application right after it finishes responding to a pjax request (qiangxue)
-
Bug #3066:
`yii\db\mssql\Schema::getTableSchema()`
should return null when the table does not exist (qiangxue)
...
...
framework/console/controllers/HelpController.php
View file @
607294a4
...
...
@@ -157,7 +157,10 @@ class HelpController extends Controller
$files
=
scandir
(
$controllerPath
);
foreach
(
$files
as
$file
)
{
if
(
strcmp
(
substr
(
$file
,
-
14
),
'Controller.php'
)
===
0
)
{
$commands
[]
=
$prefix
.
Inflector
::
camel2id
(
substr
(
basename
(
$file
),
0
,
-
14
));
$controllerClass
=
$module
->
controllerNamespace
.
'\\'
.
substr
(
basename
(
$file
),
0
,
-
4
);
if
(
$this
->
validateControllerClass
(
$controllerClass
))
{
$commands
[]
=
$prefix
.
Inflector
::
camel2id
(
substr
(
basename
(
$file
),
0
,
-
14
));
}
}
}
}
...
...
@@ -166,6 +169,21 @@ class HelpController extends Controller
}
/**
* Validates if the given class is a valid console controller class.
* @param string $controllerClass
* @return bool
*/
protected
function
validateControllerClass
(
$controllerClass
)
{
if
(
class_exists
(
$controllerClass
))
{
$class
=
new
\ReflectionClass
(
$controllerClass
);
return
!
$class
->
isAbstract
()
&&
$class
->
isSubclassOf
(
'yii\console\Controller'
);
}
else
{
return
false
;
}
}
/**
* Displays all available commands.
*/
protected
function
getHelp
()
...
...
framework/yii
View file @
607294a4
...
...
@@ -19,6 +19,7 @@ require(__DIR__ . '/Yii.php');
$application
=
new
yii\console\Application
([
'id'
=>
'yii-console'
,
'basePath'
=>
__DIR__
.
'/console'
,
'controllerNamespace'
=>
'yii\console\controllers'
,
]);
$exitCode
=
$application
->
run
();
exit
(
$exitCode
);
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