mirror of
https://github.com/yiisoft/yii2.git
synced 2026-02-20 00:32:19 +01:00
Fix #16855: Ignore console commands that have no actions
This commit is contained in:
committed by
Alexander Makarov
parent
062ebf5c0b
commit
6e2b1782e5
@@ -76,21 +76,18 @@ class UnknownCommandException extends Exception
|
||||
$availableActions = [];
|
||||
foreach ($helpController->getCommands() as $command) {
|
||||
$result = $this->application->createController($command);
|
||||
if ($result === false) {
|
||||
continue;
|
||||
}
|
||||
// add the command itself (default action)
|
||||
$availableActions[] = $command;
|
||||
|
||||
// add all actions of this controller
|
||||
/** @var $controller Controller */
|
||||
list($controller, $actionID) = $result;
|
||||
if ($controller->createAction($controller->defaultAction) !== null) {
|
||||
// add the command itself (default action)
|
||||
$availableActions[] = $command;
|
||||
}
|
||||
|
||||
// add all actions of this controller
|
||||
$actions = $helpController->getActions($controller);
|
||||
if (!empty($actions)) {
|
||||
$prefix = $controller->getUniqueId();
|
||||
foreach ($actions as $action) {
|
||||
$availableActions[] = $prefix . '/' . $action;
|
||||
}
|
||||
$prefix = $controller->getUniqueId();
|
||||
foreach ($actions as $action) {
|
||||
$availableActions[] = $prefix . '/' . $action;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user