Fix #16855: Ignore console commands that have no actions

This commit is contained in:
Dmitry V. Alekseev
2018-12-18 01:26:41 +03:00
committed by Alexander Makarov
parent 062ebf5c0b
commit 6e2b1782e5
8 changed files with 174 additions and 96 deletions

View File

@@ -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;
}
}