79 $this->arguments = $this->objectManager->get(
'TYPO3\\CMS\\Extbase\\Mvc\\Controller\\Arguments');
80 $this->userAuthentication = isset(
$GLOBALS[
'BE_USER']) ?
$GLOBALS[
'BE_USER'] : NULL;
90 return $request instanceof \TYPO3\CMS\Extbase\Mvc\Cli\Request;
104 throw new \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException(get_class($this) .
' does not support requests of type "' . get_class($request) .
'".', 1300787096);
107 $this->request->setDispatched(TRUE);
127 throw new \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchCommandException(
'A command method "' .
$commandMethodName .
'()" does not exist in controller "' . get_class($this) .
'".', 1300902143);
140 $methodParameters = $this->reflectionService->getMethodParameters(get_class($this), $this->commandMethodName);
141 foreach ($methodParameters as $parameterName => $parameterInfo) {
143 if (isset($parameterInfo[
'type'])) {
144 $dataType = $parameterInfo[
'type'];
145 } elseif ($parameterInfo[
'array']) {
148 if ($dataType === NULL) {
149 throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentTypeException(
'The argument type for parameter $' . $parameterName .
' of method ' . get_class($this) .
'->' . $this->commandMethodName .
'() could not be detected.', 1306755296);
151 $defaultValue = isset($parameterInfo[
'defaultValue']) ? $parameterInfo[
'defaultValue'] : NULL;
152 $this->arguments->addNewArgument($parameterName, $dataType, $parameterInfo[
'optional'] === FALSE, $defaultValue);
162 foreach ($this->arguments as $argument) {
163 $argumentName = $argument->getName();
164 if ($this->request->hasArgument($argumentName)) {
165 $argument->setValue($this->request->getArgument($argumentName));
166 } elseif ($argument->isRequired()) {
167 $commandArgumentDefinition = $this->objectManager->get(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandArgumentDefinition', $argumentName, TRUE, NULL);
168 $exception = new \TYPO3\CMS\Extbase\Mvc\Exception\CommandException(
'Required argument "' . $commandArgumentDefinition->getDashedName() .
'" is not set.', 1306755520);
169 $this->
forward(
'error',
'TYPO3\\CMS\\Extbase\\Command\\HelpCommandController', array(
'exception' => $exception));
186 protected function forward($commandName, $controllerObjectName = NULL, array
$arguments = array()) {
187 $this->request->setDispatched(FALSE);
188 $this->request->setControllerCommandName($commandName);
189 if ($controllerObjectName !== NULL) {
190 $this->request->setControllerObjectName($controllerObjectName);
193 $this->arguments->removeAll();
194 throw new \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException();
207 $preparedArguments = array();
208 foreach ($this->arguments as $argument) {
209 $preparedArguments[] = $argument->getValue();
212 $commandResult = call_user_func_array(array($this, $this->commandMethodName), $preparedArguments);
214 if (is_string($commandResult) && strlen($commandResult) > 0) {
215 $this->response->appendContent($commandResult);
216 } elseif (is_object($commandResult) && method_exists($commandResult,
'__toString')) {
217 $this->response->appendContent((
string) $commandResult);
228 if (!$this->requestAdminPermissions || !$this->userAuthentication || !isset($this->userAuthentication->user[
'admin'])) {
231 $originalRole = $this->userAuthentication->user[
'admin'];
232 $this->userAuthentication->user[
'admin'] = 1;
233 return $originalRole;
242 if ($originalRole !== NULL) {
243 $this->userAuthentication->user[
'admin'] = $originalRole;
260 $this->response->appendContent($text);
283 protected function quit($exitCode = 0) {
284 $this->response->setExitCode($exitCode);
285 throw new \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException();
296 $this->response->send();
mapRequestArgumentsToControllerArguments()
injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
const MAXIMUM_LINE_LENGTH
ensureAdminRoleIfRequested()
forward($commandName, $controllerObjectName=NULL, array $arguments=array())
initializeCommandMethodArguments()
resolveCommandMethodName()
outputLine($text='', array $arguments=array())
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
output($text, array $arguments=array())
canProcessRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request)
restoreUserRole($originalRole)