46 if ($this->availableCommands === NULL) {
47 $this->availableCommands = array();
48 $commandControllerClassNames = is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'extbase'][
'commandControllers']) ?
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'extbase'][
'commandControllers'] : array();
49 foreach ($commandControllerClassNames as $className) {
50 if (!class_exists($className)) {
53 foreach (get_class_methods($className) as $methodName) {
54 if (substr($methodName, -7, 7) ===
'Command') {
55 $this->availableCommands[] = $this->objectManager->get(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', $className, substr($methodName, 0, -7));
75 $commandIdentifier = strtolower(trim($commandIdentifier));
76 if ($commandIdentifier ===
'help') {
77 $commandIdentifier =
'extbase:help:help';
79 $matchedCommands = array();
83 $matchedCommands[] = $command;
86 if (count($matchedCommands) === 0) {
87 throw new \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandException(
'No command could be found that matches the command identifier "' . $commandIdentifier .
'".', 1310556663);
89 if (count($matchedCommands) > 1) {
90 throw new \TYPO3\CMS\Extbase\Mvc\Exception\AmbiguousCommandIdentifierException(
'More than one command matches the command identifier "' . $commandIdentifier .
'"', 1310557169, NULL, $matchedCommands);
92 return current($matchedCommands);
103 if ($command->getCommandIdentifier() ===
'extbase:help:help') {
108 $command->getCommandIdentifier();
119 if ($this->shortCommandIdentifiers === NULL) {
120 $commandsByCommandName = array();
122 list($extensionKey, $controllerName, $commandName) = explode(
':', $availableCommand->getCommandIdentifier());
123 if (!isset($commandsByCommandName[$commandName])) {
124 $commandsByCommandName[$commandName] = array();
126 if (!isset($commandsByCommandName[$commandName][$controllerName])) {
127 $commandsByCommandName[$commandName][$controllerName] = array();
129 $commandsByCommandName[$commandName][$controllerName][] = $extensionKey;
132 list($extensionKey, $controllerName, $commandName) = explode(
':', $availableCommand->getCommandIdentifier());
133 if (count($commandsByCommandName[$commandName][$controllerName]) > 1) {
134 $this->shortCommandIdentifiers[$availableCommand->getCommandIdentifier()] = sprintf(
'%s:%s:%s', $extensionKey, $controllerName, $commandName);
136 $this->shortCommandIdentifiers[$availableCommand->getCommandIdentifier()] = sprintf(
'%s:%s', $controllerName, $commandName);
152 $commandIdentifierParts = explode(
':', $command->getCommandIdentifier());
153 $searchedCommandIdentifierParts = explode(
':', $commandIdentifier);
154 $extensionKey = array_shift($commandIdentifierParts);
155 if (count($searchedCommandIdentifierParts) === 3) {
156 $searchedExtensionKey = array_shift($searchedCommandIdentifierParts);
157 if ($searchedExtensionKey !== $extensionKey) {
161 if (count($searchedCommandIdentifierParts) !== 2) {
164 return $searchedCommandIdentifierParts === $commandIdentifierParts;
commandMatchesIdentifier(\TYPO3\CMS\Extbase\Mvc\Cli\Command $command, $commandIdentifier)
getShortestIdentifierForCommand(\TYPO3\CMS\Extbase\Mvc\Cli\Command $command)
getShortCommandIdentifiers()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
getCommandByIdentifier($commandIdentifier)