|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
/** |
|
3
|
|
|
* Bootstrap TYPO3 |
|
4
|
|
|
* |
|
5
|
|
|
* PHP Version 5 |
|
6
|
|
|
* |
|
7
|
|
|
* @category Netresearch |
|
8
|
|
|
* @package Kite |
|
9
|
|
|
* @author Christian Opitz <[email protected]> |
|
10
|
|
|
* @author Torsten Fink <[email protected]> |
|
11
|
|
|
* @license http://www.netresearch.de Netresearch Copyright |
|
12
|
|
|
* @link http://www.netresearch.de |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
define('TYPO3_MODE', 'BE'); |
|
16
|
|
|
define('TYPO3_cliMode', true); |
|
17
|
|
|
|
|
18
|
|
|
$GLOBALS['MCONF']['name'] = '_CLI_lowlevel'; |
|
19
|
|
|
|
|
20
|
|
|
if (PHP_SAPI !== 'cli') { |
|
21
|
|
|
die('Access denied'); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
define('PATH_site', getcwd() . DIRECTORY_SEPARATOR); |
|
25
|
|
|
|
|
26
|
|
|
$typo3VersionIsMinimum7 = true; |
|
27
|
|
|
|
|
28
|
|
|
$cliBootstrapFile = 'typo3/sysext/core/Classes/Core/CliBootstrap.php'; |
|
29
|
|
|
if (file_exists($cliBootstrapFile)) { |
|
30
|
|
|
$typo3VersionIsMinimum7 = false; |
|
31
|
|
|
include $cliBootstrapFile; |
|
32
|
|
|
\TYPO3\CMS\Core\Core\CliBootstrap::checkEnvironmentOrDie(); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
if ($typo3VersionIsMinimum7) { |
|
36
|
|
|
$classLoader = include getcwd() . '/typo3_src/vendor/autoload.php'; |
|
37
|
|
|
\TYPO3\CMS\Core\Core\Bootstrap::getInstance() |
|
38
|
|
|
->initializeClassLoader($classLoader) |
|
39
|
|
|
->baseSetup(PATH_site) |
|
40
|
|
|
->configure() |
|
41
|
|
|
->loadExtensionTables(true); |
|
42
|
|
|
} else { |
|
43
|
|
|
include 'typo3/sysext/core/Classes/Core/Bootstrap.php'; |
|
44
|
|
|
\TYPO3\CMS\Core\Core\Bootstrap::getInstance() |
|
45
|
|
|
->baseSetup() |
|
46
|
|
|
->loadConfigurationAndInitialize() |
|
47
|
|
|
->loadTypo3LoadedExtAndExtLocalconf(true) |
|
48
|
|
|
->applyAdditionalConfigurationSettings() |
|
49
|
|
|
->initializeTypo3DbGlobal() |
|
50
|
|
|
->loadExtensionTables(true) |
|
51
|
|
|
->initializeBackendUser() |
|
52
|
|
|
->initializeBackendAuthentication() |
|
53
|
|
|
->initializeBackendUserMounts() |
|
54
|
|
|
->initializeLanguageObject(); |
|
55
|
|
|
} |
|
56
|
|
|
// Make sure output is not buffered, so command-line output and interaction can take place |
|
57
|
|
|
\TYPO3\CMS\Core\Utility\GeneralUtility::flushOutputBuffers(); |
|
58
|
|
|
?> |
|
59
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.