[CLEANUP] Use comments not PHPDoc style comments in copyright block
[Packages/TYPO3.CMS.git] / typo3 / cli_dispatch.phpsh
1 #! /usr/bin/env php
2 <?php
3 /*
4 * This file is part of the TYPO3 CMS project.
5 *
6 * It is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License, either version 2
8 * of the License, or any later version.
9 *
10 * For the full copyright and license information, please read the
11 * LICENSE.txt file that was distributed with this source code.
12 *
13 * The TYPO3 project - inspiring people to share!
14 */
15
16 /**
17 * Command Line Interface module dispatcher
18 *
19 * This script takes a "cliKey" as first argument and uses that to dispatch
20 * the call to a registered script with that key.
21 * Valid cliKeys must be registered in
22 * $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys'].
23 *
24 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
25 */
26 define('TYPO3_MODE', 'BE');
27 define('TYPO3_cliMode', TRUE);
28
29 require __DIR__ . '/sysext/core/Classes/Core/CliBootstrap.php';
30 \TYPO3\CMS\Core\Core\CliBootstrap::checkEnvironmentOrDie();
31
32 require __DIR__ . '/sysext/core/Classes/Core/Bootstrap.php';
33 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()
34 ->baseSetup('typo3/')
35 ->loadConfigurationAndInitialize()
36 ->loadTypo3LoadedExtAndExtLocalconf(TRUE)
37 ->applyAdditionalConfigurationSettings()
38 ->initializeTypo3DbGlobal();
39
40 \TYPO3\CMS\Core\Core\CliBootstrap::initializeCliKeyOrDie();
41
42 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()
43 ->loadExtensionTables(TRUE)
44 ->initializeBackendUser()
45 ->initializeBackendAuthentication()
46 ->initializeBackendUserMounts()
47 ->initializeLanguageObject();
48
49 // Make sure output is not buffered, so command-line output and interaction can take place
50 \TYPO3\CMS\Core\Utility\GeneralUtility::flushOutputBuffers();
51
52 try {
53 include(TYPO3_cliInclude);
54 } catch (\Exception $e) {
55 fwrite(STDERR, $e->getMessage() . LF);
56 exit(99);
57 }
58
59 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->shutdown();