[BUGFIX] Make Cli\Command Namespace aware
authorThomas Maroschik <tmaroschik@dfau.de>
Sun, 26 Aug 2012 00:08:37 +0000 (02:08 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 26 Aug 2012 00:14:57 +0000 (02:14 +0200)
Change-Id: I2e9247cac7c2df58637ea43447ac195628292b80
Fixes: #40219
Related: #40095
Releases: 6.0
Reviewed-on: http://review.typo3.org/14101
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extbase/Classes/Mvc/Cli/Command.php

index c57cfb6..3194c04 100644 (file)
@@ -73,7 +73,13 @@ class Command {
        public function __construct($controllerClassName, $controllerCommandName) {
                $this->controllerClassName = $controllerClassName;
                $this->controllerCommandName = $controllerCommandName;
-               $classNameParts = explode('_', $controllerClassName);
+               $delimiter = strpos($controllerClassName, '\\') !== FALSE ? '\\' : '_';
+               $classNameParts = explode($delimiter, $controllerClassName);
+               if (isset($classNameParts[0]) && $classNameParts[0] === 'TYPO3' && isset($classNameParts[1]) && $classNameParts[1] === 'CMS') {
+                       $classNameParts[0] .= '\\' . $classNameParts[1];
+                       unset($classNameParts[1]);
+                       $classNameParts = array_values($classNameParts);
+               }
                if (count($classNameParts) !== 4 || strpos($classNameParts[3], 'CommandController') === FALSE) {
                        throw new \InvalidArgumentException(('Invalid controller class name "' . $controllerClassName) . '"', 1305100019);
                }