TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Backend\Console\CliRequestHandler Class Reference
Inheritance diagram for TYPO3\CMS\Backend\Console\CliRequestHandler:
TYPO3\CMS\Core\Console\RequestHandlerInterface

Public Member Functions

 __construct (Bootstrap $bootstrap)
 
 handleRequest (InputInterface $input)
 
 canHandleRequest (InputInterface $input)
 
 getPriority ()
 

Protected Member Functions

 boot ($commandLineName)
 
 validateCommandLineKeyFromInput (InputInterface $input)
 
 getIncludeScriptByCommandLineKey ($cliKey)
 
 loadCommandLineBackendUser ($commandLineName)
 

Protected Attributes

 $bootstrap
 

Detailed Description

Command Line Interface Request Handler dealing with "cliKey"-based Commands from the cli_dispatch.phpsh script. Picks up requests only when coming from the CLI mode. Resolves the "cliKey" which is registered inside $TYPO3_CONF_VARS[SC_OPTIONS][GLOBAL][cliKeys] and includes the CLI-based script or exits if no valid "cliKey" is found. Also logs into the system as a backend user which needs to be added to the database called _CLI_mymodule

Definition at line 31 of file CliRequestHandler.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Console\CliRequestHandler::__construct ( Bootstrap  $bootstrap)

Constructor handing over the bootstrap

Parameters
Bootstrap$bootstrap

Definition at line 44 of file CliRequestHandler.php.

References TYPO3\CMS\Backend\Console\CliRequestHandler\$bootstrap.

Member Function Documentation

◆ boot()

TYPO3\CMS\Backend\Console\CliRequestHandler::boot (   $commandLineName)
protected

◆ canHandleRequest()

TYPO3\CMS\Backend\Console\CliRequestHandler::canHandleRequest ( InputInterface  $input)

This request handler can handle any CLI request.

Parameters
InputInterface$input
Returns
bool Always TRUE

Implements TYPO3\CMS\Core\Console\RequestHandlerInterface.

Definition at line 199 of file CliRequestHandler.php.

◆ getIncludeScriptByCommandLineKey()

TYPO3\CMS\Backend\Console\CliRequestHandler::getIncludeScriptByCommandLineKey (   $cliKey)
protected

Define cli-related parameters and return the include script as well as the command line name. Used for authentication against the backend user in the "loadCommandLineBackendUser()" action.

Parameters
string$cliKeythe CLI key
Returns
array the absolute path to the include script and the command line name

Definition at line 152 of file CliRequestHandler.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\GeneralUtility\getFileAbsFileName().

Referenced by TYPO3\CMS\Backend\Console\CliRequestHandler\handleRequest().

◆ getPriority()

TYPO3\CMS\Backend\Console\CliRequestHandler::getPriority ( )

Returns the priority - how eager the handler is to actually handle the request.

Returns
int The priority of the request handler.

Implements TYPO3\CMS\Core\Console\RequestHandlerInterface.

Definition at line 209 of file CliRequestHandler.php.

◆ handleRequest()

TYPO3\CMS\Backend\Console\CliRequestHandler::handleRequest ( InputInterface  $input)

◆ loadCommandLineBackendUser()

TYPO3\CMS\Backend\Console\CliRequestHandler::loadCommandLineBackendUser (   $commandLineName)
protected

If the backend script is in CLI mode, it will try to load a backend user named by the CLI module name (in lowercase)

Parameters
string$commandLineNamethe name of the module registered inside $TYPO3_CONF_VARS[SC_OPTIONS][GLOBAL][cliKeys] as second parameter
Exceptions

Definition at line 175 of file CliRequestHandler.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\StringUtility\beginsWith().

Referenced by TYPO3\CMS\Backend\Console\CliRequestHandler\boot().

◆ validateCommandLineKeyFromInput()

TYPO3\CMS\Backend\Console\CliRequestHandler::validateCommandLineKeyFromInput ( InputInterface  $input)
protected

Check CLI parameters. First argument is a key that points to the script configuration. If it is not set or not valid, the script exits with an error message.

Parameters
InputInterface$inputan instance of the input given to the CLI call
Returns
string the CLI key in use
Exceptions

Definition at line 134 of file CliRequestHandler.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Console\CliRequestHandler\handleRequest().

Member Data Documentation

◆ $bootstrap

TYPO3\CMS\Backend\Console\CliRequestHandler::$bootstrap
protected