2 namespace TYPO3\CMS\Backend\Console;
40 \TYPO3\CMS\Backend\Console\CliRequestHandler::class
55 ->initializeClassLoader($classLoader)
56 ->baseSetup($this->entryPointPath);
58 foreach ($this->availableRequestHandlers as $requestHandler) {
59 $this->bootstrap->registerRequestHandlerImplementation($requestHandler);
62 $this->bootstrap->configure();
71 public function run(callable $execute = null)
73 $this->bootstrap->handleRequest(
new \Symfony\Component\Console\Input\ArgvInput());
75 if ($execute !== null) {
76 call_user_func($execute);
79 $this->bootstrap->shutdown();
87 define(
'TYPO3_MODE',
'BE');
88 define(
'TYPO3_cliMode',
true);
98 if (substr(php_sapi_name(), 0, 3) ===
'cgi') {
100 }
elseif (php_sapi_name() !==
'cli') {
101 die(
'Not called from a command line interface (e.g. a shell or scheduler).' . LF);
114 $checkEnvVars = array(
'HTTP_USER_AGENT',
'HTTP_HOST',
'SERVER_NAME',
'REMOTE_ADDR',
'REMOTE_PORT',
'SERVER_PROTOCOL');
115 foreach ($checkEnvVars as $var) {
116 if (array_key_exists($var, $_SERVER)) {
117 echo
'SECURITY CHECK FAILED! This script cannot be used within your browser!' . LF;
118 echo
'If you are sure that we run in a shell or cronjob, please unset' . LF;
119 echo
'environment variable ' . $var .
' (usually using \'unset ' . $var .
'\')
' . LF;
120 echo 'before starting
this script.
' . LF;
125 // Mimic CLI API in CGI API (you must use the -C/-no-chdir and the -q/--no-header switches!)
126 ini_set('html_errors
', 0);
127 ini_set('implicit_flush
', 1);
128 ini_set('max_execution_time
', 0);
129 define('STDIN
', fopen('php:
130 define(
'STDOUT', fopen(
'php://stdout',
'w'));
131 define(
'STDERR', fopen(
'php://stderr',
'w'));