[TASK] Release installation procedure from LocalConfiguration file
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Core / Bootstrap.php
1 <?php
2 namespace TYPO3\CMS\Core\Core;
3 use \TYPO3\CMS\Core\Utility;
4
5 /***************************************************************
6 * Copyright notice
7 *
8 * (c) 2012-2013 Christian Kuhn <lolli@schwarzbu.ch>
9 * All rights reserved
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 * A copy is found in the textfile GPL.txt and important notices to the license
20 * from the author is found in LICENSE.txt distributed with these scripts.
21 *
22 *
23 * This script is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * This copyright notice MUST APPEAR in all copies of the script!
29 ***************************************************************/
30
31 require 'SystemEnvironmentBuilder.php';
32
33 /**
34 * This class encapsulates bootstrap related methods.
35 * It is required directly as the very first thing in entry scripts and
36 * used to define all base things like constants and pathes and so on.
37 *
38 * Most methods in this class have dependencies to each other. They can
39 * not be called in arbitrary order. The methods are ordered top down, so
40 * a method at the beginning has lower dependencies than a method further
41 * down. Do not fiddle with the load order in own scripts except you know
42 * exactly what you are doing!
43 *
44 * @author Christian Kuhn <lolli@schwarzbu.ch>
45 */
46 class Bootstrap {
47
48 /**
49 * @var \TYPO3\CMS\Core\Core\Bootstrap
50 */
51 static protected $instance = NULL;
52
53 /**
54 * Unique Request ID
55 *
56 * @var string
57 */
58 protected $requestId;
59
60 /**
61 * Disable direct creation of this object.
62 */
63 protected function __construct() {
64 $this->requestId = uniqid();
65 }
66
67 /**
68 * Disable direct cloning of this object.
69 */
70 protected function __clone() {
71
72 }
73
74 /**
75 * Return 'this' as singleton
76 *
77 * @return \TYPO3\CMS\Core\Core\Bootstrap
78 * @internal This is not a public API method, do not use in own extensions
79 */
80 static public function getInstance() {
81 if (is_null(self::$instance)) {
82 self::$instance = new \TYPO3\CMS\Core\Core\Bootstrap();
83 }
84 return self::$instance;
85 }
86
87 /**
88 * Gets the request's unique ID
89 *
90 * @return string Unique request ID
91 * @internal This is not a public API method, do not use in own extensions
92 */
93 public function getRequestId() {
94 return $this->requestId;
95 }
96
97 /**
98 * Prevent any unwanted output that may corrupt AJAX/compression.
99 * This does not interfere with "die()" or "echo"+"exit()" messages!
100 *
101 * @return \TYPO3\CMS\Core\Core\Bootstrap
102 * @internal This is not a public API method, do not use in own extensions
103 */
104 public function startOutputBuffering() {
105 ob_start();
106 return $this;
107 }
108
109 /**
110 * Run the base setup that checks server environment,
111 * determines pathes, populates base files and sets common configuration.
112 *
113 * Script execution will be aborted if something fails here.
114 *
115 * @param string $relativePathPart Relative path of the entry script back to document root
116 * @return \TYPO3\CMS\Core\Core\Bootstrap
117 * @internal This is not a public API method, do not use in own extensions
118 */
119 public function baseSetup($relativePathPart = '') {
120 \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run($relativePathPart);
121 return $this;
122 }
123
124 /**
125 * Redirect to install tool if LocalConfiguration.php is missing
126 *
127 * @param string $pathUpToDocumentRoot Can contain eg. '../' if called from a sub directory
128 * @return \TYPO3\CMS\Core\Core\Bootstrap
129 * @internal This is not a public API method, do not use in own extensions
130 */
131 public function redirectToInstallToolIfLocalConfigurationFileDoesNotExist($pathUpToDocumentRoot = '') {
132 /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
133 $configurationManager = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
134 if (
135 !file_exists($configurationManager->getLocalConfigurationFileLocation())
136 && !file_exists($configurationManager->getLocalconfFileLocation())
137 ) {
138 require_once __DIR__ . '/../Utility/HttpUtility.php';
139 Utility\HttpUtility::redirect($pathUpToDocumentRoot . 'typo3/install/index.php?mode=123&step=1&password=joh316');
140 }
141 return $this;
142 }
143
144 /**
145 * Includes LocalConfiguration.php and sets several
146 * global settings depending on configuration.
147 *
148 * @return \TYPO3\CMS\Core\Core\Bootstrap
149 * @internal This is not a public API method, do not use in own extensions
150 */
151 public function loadConfigurationAndInitialize() {
152 $this->getInstance()
153 ->populateLocalConfiguration()
154 ->registerExtDirectComponents()
155 ->initializeCachingFramework()
156 ->registerAutoloader()
157 ->checkUtf8DatabaseSettingsOrDie()
158 ->transferDeprecatedCurlSettings()
159 ->setCacheHashOptions()
160 ->enforceCorrectProxyAuthScheme()
161 ->setDefaultTimezone()
162 ->initializeL10nLocales()
163 ->configureImageProcessingOptions()
164 ->convertPageNotFoundHandlingToBoolean()
165 ->registerGlobalDebugFunctions()
166 ->registerSwiftMailer()
167 ->configureExceptionHandling()
168 ->setMemoryLimit()
169 ->defineTypo3RequestTypes();
170 return $this;
171 }
172
173 /**
174 * Load TYPO3_LOADED_EXT and ext_localconf
175 *
176 * @param boolean $allowCaching
177 * @return \TYPO3\CMS\Core\Core\Bootstrap
178 * @internal This is not a public API method, do not use in own extensions
179 */
180 public function loadTypo3LoadedExtAndExtLocalconf($allowCaching = TRUE) {
181 $this->getInstance()
182 ->populateTypo3LoadedExtGlobal($allowCaching)
183 ->loadAdditionalConfigurationFromExtensions($allowCaching);
184 return $this;
185 }
186
187 /**
188 * Load TYPO3_LOADED_EXT, recreate class loader registry and load ext_localconf
189 *
190 * @param boolean $allowCaching
191 * @return \TYPO3\CMS\Core\Core\Bootstrap
192 * @internal This is not a public API method, do not use in own extensions
193 */
194 public function reloadTypo3LoadedExtAndClassLoaderAndExtLocalconf() {
195 $bootstrap = $this->getInstance();
196 $bootstrap->populateTypo3LoadedExtGlobal(FALSE);
197 \TYPO3\CMS\Core\Core\ClassLoader::loadClassLoaderCache();
198 $bootstrap->loadAdditionalConfigurationFromExtensions(FALSE);
199 return $this;
200 }
201
202 /**
203 * Sets up additional configuration applied in all scopes
204 *
205 * @return \TYPO3\CMS\Core\Core\Bootstrap
206 * @internal This is not a public API method, do not use in own extensions
207 */
208 public function applyAdditionalConfigurationSettings() {
209 $this->getInstance()
210 ->deprecationLogForOldExtCacheSetting()
211 ->initializeExceptionHandling()
212 ->setFinalCachingFrameworkCacheConfiguration()
213 ->defineLoggingAndExceptionConstants()
214 ->unsetReservedGlobalVariables();
215 return $this;
216 }
217
218 /**
219 * Throws an exception if no browser could be identified
220 *
221 * @return \TYPO3\CMS\Core\Core\Bootstrap
222 * @throws \RuntimeException
223 * @internal This is not a public API method, do not use in own extensions
224 */
225 public function checkValidBrowserOrDie() {
226 // Checks for proper browser
227 if (empty($GLOBALS['CLIENT']['BROWSER'])) {
228 throw new \RuntimeException('Browser Error: Your browser version looks incompatible with this TYPO3 version!', 1294587023);
229 }
230 return $this;
231 }
232
233 /**
234 * Populate the local configuration.
235 * Merge default TYPO3_CONF_VARS with content of typo3conf/LocalConfiguration.php,
236 * execute typo3conf/AdditionalConfiguration.php, define database related constants.
237 *
238 * @return \TYPO3\CMS\Core\Core\Bootstrap
239 */
240 protected function populateLocalConfiguration() {
241 try {
242 Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')
243 ->exportConfiguration();
244 } catch (\Exception $e) {
245 die($e->getMessage());
246 }
247 define('TYPO3_db', $GLOBALS['TYPO3_CONF_VARS']['DB']['database']);
248 define('TYPO3_db_username', $GLOBALS['TYPO3_CONF_VARS']['DB']['username']);
249 define('TYPO3_db_password', $GLOBALS['TYPO3_CONF_VARS']['DB']['password']);
250 define('TYPO3_db_host', $GLOBALS['TYPO3_CONF_VARS']['DB']['host']);
251 define('TYPO3_extTableDef_script',
252 isset($GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript'])
253 ? $GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript']
254 : 'extTables.php');
255 unset($GLOBALS['TYPO3_CONF_VARS']['DB']);
256 define('TYPO3_user_agent', 'User-Agent: ' . $GLOBALS['TYPO3_CONF_VARS']['HTTP']['userAgent']);
257 return $this;
258 }
259
260 /**
261 * Register default ExtDirect components
262 *
263 * @return \TYPO3\CMS\Core\Core\Bootstrap
264 */
265 protected function registerExtDirectComponents() {
266 if (TYPO3_MODE === 'BE') {
267 Utility\ExtensionManagementUtility::registerExtDirectComponent('TYPO3.Components.PageTree.DataProvider', 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\ExtdirectTreeDataProvider', 'web', 'user,group');
268 Utility\ExtensionManagementUtility::registerExtDirectComponent('TYPO3.Components.PageTree.Commands', 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\ExtdirectTreeCommands', 'web', 'user,group');
269 Utility\ExtensionManagementUtility::registerExtDirectComponent('TYPO3.Components.PageTree.ContextMenuDataProvider', 'TYPO3\\CMS\\Backend\\ContextMenu\\Pagetree\\Extdirect\\ContextMenuConfiguration', 'web', 'user,group');
270 Utility\ExtensionManagementUtility::registerExtDirectComponent('TYPO3.LiveSearchActions.ExtDirect', 'TYPO3\\CMS\\Backend\\Search\\LiveSearch\\ExtDirect\\LiveSearchDataProvider', 'web_list', 'user,group');
271 Utility\ExtensionManagementUtility::registerExtDirectComponent('TYPO3.BackendUserSettings.ExtDirect', 'TYPO3\\CMS\\Backend\\User\\ExtDirect\\BackendUserSettingsDataProvider');
272 Utility\ExtensionManagementUtility::registerExtDirectComponent('TYPO3.CSH.ExtDirect', 'TYPO3\\CMS\\ContextHelp\\ExtDirect\\ContextHelpDataProvider');
273 Utility\ExtensionManagementUtility::registerExtDirectComponent('TYPO3.ExtDirectStateProvider.ExtDirect', 'TYPO3\\CMS\\Backend\\InterfaceState\\ExtDirect\\DataProvider');
274 Utility\ExtensionManagementUtility::registerExtDirectComponent(
275 'TYPO3.Components.DragAndDrop.CommandController',
276 Utility\ExtensionManagementUtility::extPath('backend') . 'Classes/View/PageLayout/Extdirect/ExtdirectPageCommands.php:TYPO3\\CMS\\Backend\\View\\PageLayout\\ExtDirect\\ExtdirectPageCommands', 'web', 'user,group'
277 );
278 }
279 return $this;
280 }
281
282 /**
283 * Initialize caching framework
284 *
285 * @return \TYPO3\CMS\Core\Core\Bootstrap
286 */
287 protected function initializeCachingFramework() {
288 \TYPO3\CMS\Core\Cache\Cache::initializeCachingFramework();
289 return $this;
290 }
291
292 /**
293 * Register autoloader
294 *
295 * @return \TYPO3\CMS\Core\Core\Bootstrap
296 */
297 protected function registerAutoloader() {
298 if (PHP_VERSION_ID < 50307) {
299 \TYPO3\CMS\Core\Compatibility\CompatbilityClassLoaderPhpBelow50307::registerAutoloader();
300 } else {
301 \TYPO3\CMS\Core\Core\ClassLoader::registerAutoloader();
302 }
303 return $this;
304 }
305
306 /**
307 * Checking for UTF-8 in the settings since TYPO3 4.5
308 *
309 * Since TYPO3 4.5, everything other than UTF-8 is deprecated.
310 *
311 * [BE][forceCharset] is set to the charset that TYPO3 is using
312 * [SYS][setDBinit] is used to set the DB connection
313 * and both settings need to be adjusted for UTF-8 in order to work properly
314 *
315 * @return \TYPO3\CMS\Core\Core\Bootstrap
316 */
317 protected function checkUtf8DatabaseSettingsOrDie() {
318 // Check if [BE][forceCharset] has been set in localconf.php
319 if (isset($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'])) {
320 // die() unless we're already on UTF-8
321 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] != 'utf-8' &&
322 $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] &&
323 TYPO3_enterInstallScript !== '1') {
324
325 die('This installation was just upgraded to a new TYPO3 version. Since TYPO3 4.7, utf-8 is always enforced.<br />' .
326 'The configuration option $GLOBALS[\'TYPO3_CONF_VARS\'][BE][forceCharset] was marked as deprecated in TYPO3 4.5 and is now ignored.<br />' .
327 'You have configured the value to something different, which is not supported anymore.<br />' .
328 'Please proceed to the Update Wizard in the TYPO3 Install Tool to update your configuration.'
329 );
330 } else {
331 unset($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']);
332 }
333 }
334
335 if (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit']) &&
336 $GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'] !== '-1' &&
337 preg_match('/SET NAMES [\'"]?utf8[\'"]?/i', $GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit']) === FALSE &&
338 TYPO3_enterInstallScript !== '1') {
339
340 // Only accept "SET NAMES utf8" for this setting, otherwise die with a nice error
341 die('This TYPO3 installation is using the $GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'setDBinit\'] property with the following value:' . chr(10) .
342 $GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'] . chr(10) . chr(10) .
343 'It looks like UTF-8 is not used for this connection.' . chr(10) . chr(10) .
344 'Everything other than UTF-8 is unsupported since TYPO3 4.7.' . chr(10) .
345 'The DB, its connection and TYPO3 should be migrated to UTF-8 therefore. Please check your setup.'
346 );
347 } else {
348 $GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'] = 'SET NAMES utf8;';
349 }
350 return $this;
351 }
352
353 /**
354 * Parse old curl options and set new http ones instead
355 *
356 * @TODO : This code segment must still be finished
357 * @return \TYPO3\CMS\Core\Core\Bootstrap
358 */
359 protected function transferDeprecatedCurlSettings() {
360 if (!empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer'])) {
361 $proxyParts = explode(':', $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer'], 2);
362 $GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_host'] = $proxyParts[0];
363 $GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_port'] = $proxyParts[1];
364 }
365 if (!empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass'])) {
366 $userPassParts = explode(':', $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass'], 2);
367 $GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_user'] = $userPassParts[0];
368 $GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_password'] = $userPassParts[1];
369 }
370 return $this;
371 }
372
373 /**
374 * Set cacheHash options
375 *
376 * @return \TYPO3\CMS\Core\Core\Bootstrap
377 */
378 protected function setCacheHashOptions() {
379 $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash'] = array(
380 'cachedParametersWhiteList' => Utility\GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['cHashOnlyForParameters'], TRUE),
381 'excludedParameters' => Utility\GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['cHashExcludedParameters'], TRUE),
382 'requireCacheHashPresenceParameters' => Utility\GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['cHashRequiredParameters'], TRUE)
383 );
384 if (trim($GLOBALS['TYPO3_CONF_VARS']['FE']['cHashExcludedParametersIfEmpty']) === '*') {
385 $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludeAllEmptyParameters'] = TRUE;
386 } else {
387 $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParametersIfEmpty'] = Utility\GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['cHashExcludedParametersIfEmpty'], TRUE);
388 }
389 return $this;
390 }
391
392 /**
393 * $GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_auth_scheme'] must be either
394 * 'digest' or 'basic' with fallback to 'basic'
395 *
396 * @return \TYPO3\CMS\Core\Core\Bootstrap
397 */
398 protected function enforceCorrectProxyAuthScheme() {
399 $GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_auth_scheme'] === 'digest' ?: ($GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_auth_scheme'] = 'basic');
400 return $this;
401 }
402
403 /**
404 * Set default timezone
405 *
406 * @return \TYPO3\CMS\Core\Core\Bootstrap
407 */
408 protected function setDefaultTimezone() {
409 $timeZone = $GLOBALS['TYPO3_CONF_VARS']['SYS']['phpTimeZone'];
410 if (empty($timeZone)) {
411 // Time zone from the server environment (TZ env or OS query)
412 $defaultTimeZone = @date_default_timezone_get();
413 if ($defaultTimeZone !== '') {
414 $timeZone = $defaultTimeZone;
415 } else {
416 $timeZone = 'UTC';
417 }
418 }
419 // Set default to avoid E_WARNINGs with PHP > 5.3
420 date_default_timezone_set($timeZone);
421 return $this;
422 }
423
424 /**
425 * Initialize the locales handled by TYPO3
426 *
427 * @return \TYPO3\CMS\Core\Core\Bootstrap
428 */
429 protected function initializeL10nLocales() {
430 \TYPO3\CMS\Core\Localization\Locales::initialize();
431 return $this;
432 }
433
434 /**
435 * Based on the configuration of the image processing some options are forced
436 * to simplify configuration settings and combinations
437 *
438 * @return \TYPO3\CMS\Core\Core\Bootstrap
439 */
440 protected function configureImageProcessingOptions() {
441 if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['image_processing']) {
442 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im'] = 0;
443 $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'] = 0;
444 }
445 if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['im']) {
446 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'] = '';
447 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'] = '';
448 $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] = 'gif,jpg,jpeg,png';
449 $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] = 0;
450 }
451 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']) {
452 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_negate_mask'] = 1;
453 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_no_effects'] = 1;
454 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_gif'] = 1;
455 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] === 'gm') {
456 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_negate_mask'] = 0;
457 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_imvMaskState'] = 0;
458 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_no_effects'] = 1;
459 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_v5effects'] = -1;
460 }
461 }
462 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_imvMaskState']) {
463 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_negate_mask'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_negate_mask'] ? 0 : 1;
464 }
465 return $this;
466 }
467
468 /**
469 * Convert type of "pageNotFound_handling" setting in case it was written as a
470 * string (e.g. if edited in Install Tool)
471 *
472 * @TODO : Remove, if the Install Tool handles such data types correctly
473 * @return \TYPO3\CMS\Core\Core\Bootstrap
474 */
475 protected function convertPageNotFoundHandlingToBoolean() {
476 if (!strcasecmp($GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'], 'TRUE')) {
477 $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = TRUE;
478 }
479 return $this;
480 }
481
482 /**
483 * Register xdebug(), debug(), debugBegin() and debugEnd() as global functions
484 *
485 * Note: Yes, this is possible in php! xdebug() is then a global function, even
486 * if registerGlobalDebugFunctions() is encapsulated in class scope.
487 *
488 * @return \TYPO3\CMS\Core\Core\Bootstrap
489 */
490 protected function registerGlobalDebugFunctions() {
491 require_once('GlobalDebugFunctions.php');
492 return $this;
493 }
494
495 /**
496 * Mail sending via Swift Mailer
497 *
498 * @return \TYPO3\CMS\Core\Core\Bootstrap
499 */
500 protected function registerSwiftMailer() {
501 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery'][] = 'TYPO3\\CMS\\Core\\Mail\\SwiftMailerAdapter';
502 return $this;
503 }
504
505 /**
506 * Configure and set up exception and error handling
507 *
508 * @return \TYPO3\CMS\Core\Core\Bootstrap
509 */
510 protected function configureExceptionHandling() {
511 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['errors']['exceptionHandler'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'];
512 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['errors']['exceptionalErrors'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['exceptionalErrors'];
513 // Turn error logging on/off.
514 if (($displayErrors = intval($GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'])) != '-1') {
515 // Special value "2" enables this feature only if $GLOBALS['TYPO3_CONF_VARS'][SYS][devIPmask] matches
516 if ($displayErrors == 2) {
517 if (Utility\GeneralUtility::cmpIP(Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
518 $displayErrors = 1;
519 } else {
520 $displayErrors = 0;
521 }
522 }
523 if ($displayErrors == 0) {
524 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['errors']['exceptionalErrors'] = 0;
525 }
526 if ($displayErrors == 1) {
527 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['errors']['exceptionHandler'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'];
528 define('TYPO3_ERRORHANDLER_MODE', 'debug');
529 }
530 @ini_set('display_errors', $displayErrors);
531 } elseif (Utility\GeneralUtility::cmpIP(Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
532 // With displayErrors = -1 (default), turn on debugging if devIPmask matches:
533 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['errors']['exceptionHandler'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'];
534 }
535 return $this;
536 }
537
538 /**
539 * Set PHP memory limit depending on value of
540 * $GLOBALS['TYPO3_CONF_VARS']['SYS']['setMemoryLimit']
541 *
542 * @return \TYPO3\CMS\Core\Core\Bootstrap
543 */
544 protected function setMemoryLimit() {
545 if (intval($GLOBALS['TYPO3_CONF_VARS']['SYS']['setMemoryLimit']) > 16) {
546 @ini_set('memory_limit', (intval($GLOBALS['TYPO3_CONF_VARS']['SYS']['setMemoryLimit']) . 'm'));
547 }
548 return $this;
549 }
550
551 /**
552 * Define TYPO3_REQUESTTYPE* constants
553 * so devs exactly know what type of request it is
554 *
555 * @return \TYPO3\CMS\Core\Core\Bootstrap
556 */
557 protected function defineTypo3RequestTypes() {
558 define('TYPO3_REQUESTTYPE_FE', 1);
559 define('TYPO3_REQUESTTYPE_BE', 2);
560 define('TYPO3_REQUESTTYPE_CLI', 4);
561 define('TYPO3_REQUESTTYPE_AJAX', 8);
562 define('TYPO3_REQUESTTYPE_INSTALL', 16);
563 define('TYPO3_REQUESTTYPE', (TYPO3_MODE == 'FE' ? TYPO3_REQUESTTYPE_FE : 0) | (TYPO3_MODE == 'BE' ? TYPO3_REQUESTTYPE_BE : 0) | (defined('TYPO3_cliMode') && TYPO3_cliMode ? TYPO3_REQUESTTYPE_CLI : 0) | (defined('TYPO3_enterInstallScript') && TYPO3_enterInstallScript ? TYPO3_REQUESTTYPE_INSTALL : 0) | ($GLOBALS['TYPO3_AJAX'] ? TYPO3_REQUESTTYPE_AJAX : 0));
564 return $this;
565 }
566
567 /**
568 * Set up $GLOBALS['TYPO3_LOADED_EXT'] array with basic information
569 * about extensions.
570 *
571 * @param boolean $allowCaching
572 * @return \TYPO3\CMS\Core\Core\Bootstrap
573 */
574 protected function populateTypo3LoadedExtGlobal($allowCaching = TRUE) {
575 $GLOBALS['TYPO3_LOADED_EXT'] = Utility\ExtensionManagementUtility::loadTypo3LoadedExtensionInformation($allowCaching);
576 return $this;
577 }
578
579 /**
580 * Load extension configuration files (ext_localconf.php)
581 *
582 * The ext_localconf.php files in extensions are meant to make changes
583 * to the global $TYPO3_CONF_VARS configuration array.
584 *
585 * @param boolean $allowCaching
586 * @return \TYPO3\CMS\Core\Core\Bootstrap
587 */
588 protected function loadAdditionalConfigurationFromExtensions($allowCaching = TRUE) {
589 Utility\ExtensionManagementUtility::loadExtLocalconf($allowCaching);
590 return $this;
591 }
592
593 /**
594 * Write deprecation log if deprecated extCache setting was set in the instance.
595 *
596 * @return \TYPO3\CMS\Core\Core\Bootstrap
597 * @deprecated since 6.0, the check will be removed two version later.
598 */
599 protected function deprecationLogForOldExtCacheSetting() {
600 if (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['extCache']) && $GLOBALS['TYPO3_CONF_VARS']['SYS']['extCache'] !== -1) {
601 Utility\GeneralUtility::deprecationLog('Setting $GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'extCache\'] is unused and can be removed from localconf.php');
602 }
603 return $this;
604 }
605
606 /**
607 * Initialize exception handling
608 *
609 * @return \TYPO3\CMS\Core\Core\Bootstrap
610 */
611 protected function initializeExceptionHandling() {
612 if ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['errors']['exceptionHandler'] !== '') {
613 if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandler'] !== '') {
614 // Register an error handler for the given errorHandlerErrors
615 $errorHandler = Utility\GeneralUtility::makeInstance($GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandler'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors']);
616 // Set errors which will be converted in an exception
617 $errorHandler->setExceptionalErrors($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['errors']['exceptionalErrors']);
618 }
619 // Instantiate the exception handler once to make sure object is registered
620 // @TODO: Figure out if this is really needed
621 Utility\GeneralUtility::makeInstance($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['errors']['exceptionHandler']);
622 }
623 return $this;
624 }
625
626 /**
627 * Extensions may register new caches, so we set the
628 * global cache array to the manager again at this point
629 *
630 * @return \TYPO3\CMS\Core\Core\Bootstrap
631 */
632 protected function setFinalCachingFrameworkCacheConfiguration() {
633 $GLOBALS['typo3CacheManager']->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
634 return $this;
635 }
636
637 /**
638 * Define logging and exception constants
639 *
640 * @return \TYPO3\CMS\Core\Core\Bootstrap
641 */
642 protected function defineLoggingAndExceptionConstants() {
643 define('TYPO3_DLOG', $GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']);
644 define('TYPO3_ERROR_DLOG', $GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_errorDLOG']);
645 define('TYPO3_EXCEPTION_DLOG', $GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_exceptionDLOG']);
646 return $this;
647 }
648
649 /**
650 * Unsetting reserved global variables:
651 * Those are set in "ext:core/ext_tables.php" file:
652 *
653 * @return \TYPO3\CMS\Core\Core\Bootstrap
654 */
655 protected function unsetReservedGlobalVariables() {
656 unset($GLOBALS['PAGES_TYPES']);
657 unset($GLOBALS['TCA']);
658 unset($GLOBALS['TBE_MODULES']);
659 unset($GLOBALS['TBE_STYLES']);
660 unset($GLOBALS['FILEICONS']);
661 // Those set in init.php:
662 unset($GLOBALS['WEBMOUNTS']);
663 unset($GLOBALS['FILEMOUNTS']);
664 unset($GLOBALS['BE_USER']);
665 // Those set otherwise:
666 unset($GLOBALS['TBE_MODULES_EXT']);
667 unset($GLOBALS['TCA_DESCR']);
668 unset($GLOBALS['LOCAL_LANG']);
669 unset($GLOBALS['TYPO3_AJAX']);
670 return $this;
671 }
672
673 /**
674 * Initialize t3lib_db in $GLOBALS and connect if requested
675 *
676 * @param boolean $connect Whether db should be connected
677 * @return \TYPO3\CMS\Core\Core\Bootstrap
678 * @internal This is not a public API method, do not use in own extensions
679 */
680 public function initializeTypo3DbGlobal($connect = TRUE) {
681 /** @var TYPO3_DB TYPO3\CMS\Core\Database\DatabaseConnection */
682 $GLOBALS['TYPO3_DB'] = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\DatabaseConnection');
683 $GLOBALS['TYPO3_DB']->debugOutput = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sqlDebug'];
684 if ($connect) {
685 $this->establishDatabaseConnection();
686 }
687 return $this;
688 }
689
690 /**
691 * Check adminOnly configuration variable and redirects
692 * to an URL in file typo3conf/LOCK_BACKEND or exit the script
693 *
694 * @throws \RuntimeException
695 * @return \TYPO3\CMS\Core\Core\Bootstrap
696 * @internal This is not a public API method, do not use in own extensions
697 */
698 public function checkLockedBackendAndRedirectOrDie() {
699 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['adminOnly'] < 0) {
700 throw new \RuntimeException('TYPO3 Backend locked: Backend and Install Tool are locked for maintenance. [BE][adminOnly] is set to "' . intval($GLOBALS['TYPO3_CONF_VARS']['BE']['adminOnly']) . '".', 1294586847);
701 }
702 if (@is_file((PATH_typo3conf . 'LOCK_BACKEND'))) {
703 if (TYPO3_PROCEED_IF_NO_USER === 2) {
704
705 } else {
706 $fileContent = Utility\GeneralUtility::getUrl(PATH_typo3conf . 'LOCK_BACKEND');
707 if ($fileContent) {
708 header('Location: ' . $fileContent);
709 } else {
710 throw new \RuntimeException('TYPO3 Backend locked: Browser backend is locked for maintenance. Remove lock by removing the file "typo3conf/LOCK_BACKEND" or use CLI-scripts.', 1294586848);
711 }
712 die;
713 }
714 }
715 return $this;
716 }
717
718 /**
719 * Compare client IP with IPmaskList and exit the script run
720 * if the client is not allowed to access the backend
721 *
722 * @return \TYPO3\CMS\Core\Core\Bootstrap
723 * @internal This is not a public API method, do not use in own extensions
724 */
725 public function checkBackendIpOrDie() {
726 if (trim($GLOBALS['TYPO3_CONF_VARS']['BE']['IPmaskList'])) {
727 if (!Utility\GeneralUtility::cmpIP(Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['BE']['IPmaskList'])) {
728 // Send Not Found header - if the webserver can make use of it
729 header('Status: 404 Not Found');
730 // Just point us away from here...
731 header('Location: http://');
732 // ... and exit good!
733 die;
734 }
735 }
736 return $this;
737 }
738
739 /**
740 * Check lockSSL configuration variable and redirect
741 * to https version of the backend if needed
742 *
743 * @return \TYPO3\CMS\Core\Core\Bootstrap
744 * @internal This is not a public API method, do not use in own extensions
745 */
746 public function checkSslBackendAndRedirectIfNeeded() {
747 if (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'])) {
748 if (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSLPort'])) {
749 $sslPortSuffix = ':' . intval($GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSLPort']);
750 } else {
751 $sslPortSuffix = '';
752 }
753 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'] == 3) {
754 $requestStr = substr(Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_SCRIPT'), strlen(Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir));
755 if ($requestStr === 'index.php' && !Utility\GeneralUtility::getIndpEnv('TYPO3_SSL')) {
756 list(, $url) = explode('://', Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), 2);
757 list($server, $address) = explode('/', $url, 2);
758 header('Location: https://' . $server . $sslPortSuffix . '/' . $address);
759 die;
760 }
761 } elseif (!Utility\GeneralUtility::getIndpEnv('TYPO3_SSL')) {
762 if (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL']) === 2) {
763 list(, $url) = explode('://', Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir, 2);
764 list($server, $address) = explode('/', $url, 2);
765 header('Location: https://' . $server . $sslPortSuffix . '/' . $address);
766 } else {
767 // Send Not Found header - if the webserver can make use of it...
768 header('Status: 404 Not Found');
769 // Just point us away from here...
770 header('Location: http://');
771 }
772 // ... and exit good!
773 die;
774 }
775 }
776 return $this;
777 }
778
779 /**
780 * Establish connection to the database
781 *
782 * @return \TYPO3\CMS\Core\Core\Bootstrap
783 * @internal This is not a public API method, do not use in own extensions
784 */
785 public function establishDatabaseConnection() {
786 $GLOBALS['TYPO3_DB']->connectDB();
787 return $this;
788 }
789
790 /**
791 * Load TCA for frontend
792 *
793 * This method is *only* executed in frontend scope. The idea is to execute the
794 * whole TCA and ext_tables (which manipulate TCA) on first frontend access,
795 * and then cache the full TCA on disk to be used for the next run again.
796 *
797 * This way, ext_tables.php ist not executed every time, but $GLOBALS['TCA']
798 * is still always there.
799 *
800 * @return \TYPO3\CMS\Core\Core\Bootstrap
801 * @internal This is not a public API method, do not use in own extensions
802 */
803 public function loadCachedTca() {
804 $cacheIdentifier = 'tca_fe_' . sha1((TYPO3_version . PATH_site . 'tca_fe'));
805 /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
806 $codeCache = $GLOBALS['typo3CacheManager']->getCache('cache_core');
807 if ($codeCache->has($cacheIdentifier)) {
808 $codeCache->requireOnce($cacheIdentifier);
809 } else {
810 $this->loadExtensionTables(TRUE);
811 $phpCodeToCache = '$GLOBALS[\'TCA\'] = ';
812 $phpCodeToCache .= Utility\ArrayUtility::arrayExport($GLOBALS['TCA']);
813 $phpCodeToCache .= ';';
814 $codeCache->set($cacheIdentifier, $phpCodeToCache);
815 }
816 return $this;
817 }
818
819 /**
820 * Load ext_tables and friends.
821 *
822 * This will mainly set up $TCA and several other global arrays
823 * through API's like extMgm.
824 * Executes ext_tables.php files of loaded extensions or the
825 * according cache file if exists.
826 *
827 * @param boolean $allowCaching True, if reading compiled ext_tables file from cache is allowed
828 * @return \TYPO3\CMS\Core\Core\Bootstrap
829 * @internal This is not a public API method, do not use in own extensions
830 */
831 public function loadExtensionTables($allowCaching = TRUE) {
832 Utility\ExtensionManagementUtility::loadBaseTca($allowCaching);
833 Utility\ExtensionManagementUtility::loadExtTables($allowCaching);
834 $this->executeExtTablesAdditionalFile();
835 $this->runExtTablesPostProcessingHooks();
836 return $this;
837 }
838
839 /**
840 * Execute TYPO3_extTableDef_script if defined and exists
841 *
842 * Note: For backwards compatibility some global variables are
843 * explicitly set as global to be used without $GLOBALS[] in
844 * the extension table script. It is discouraged to access variables like
845 * $TBE_MODULES directly, but we can not prohibit
846 * this without heavily breaking backwards compatibility.
847 *
848 * @TODO : We could write a scheduler / reports module or an update checker
849 * @TODO : It should be defined, which global arrays are ok to be manipulated
850 *
851 * @return void
852 */
853 protected function executeExtTablesAdditionalFile() {
854 // It is discouraged to use those global variables directly, but we
855 // can not prohibit this without breaking backwards compatibility
856 global $T3_SERVICES, $T3_VAR, $TYPO3_CONF_VARS;
857 global $TBE_MODULES, $TBE_MODULES_EXT, $TCA;
858 global $PAGES_TYPES, $TBE_STYLES, $FILEICONS;
859 global $_EXTKEY;
860 // Load additional ext tables script if the file exists
861 $extTablesFile = PATH_typo3conf . TYPO3_extTableDef_script;
862 if (file_exists($extTablesFile) && is_file($extTablesFile)) {
863 include $extTablesFile;
864 }
865 }
866
867 /**
868 * Check for registered ext tables hooks and run them
869 *
870 * @throws \UnexpectedValueException
871 * @return void
872 */
873 protected function runExtTablesPostProcessingHooks() {
874 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['extTablesInclusion-PostProcessing'])) {
875 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['extTablesInclusion-PostProcessing'] as $classReference) {
876 /** @var $hookObject \TYPO3\CMS\Core\Database\TableConfigurationPostProcessingHookInterface */
877 $hookObject = Utility\GeneralUtility::getUserObj($classReference);
878 if (!$hookObject instanceof \TYPO3\CMS\Core\Database\TableConfigurationPostProcessingHookInterface) {
879 throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Core\\Database\\TableConfigurationPostProcessingHookInterface', 1320585902);
880 }
881 $hookObject->processData();
882 }
883 }
884 }
885
886 /**
887 * Initialize sprite manager
888 *
889 * @return \TYPO3\CMS\Core\Core\Bootstrap
890 * @internal This is not a public API method, do not use in own extensions
891 */
892 public function initializeSpriteManager() {
893 \TYPO3\CMS\Backend\Sprite\SpriteManager::initialize();
894 return $this;
895 }
896
897 /**
898 * Initialize backend user object in globals
899 *
900 * @return \TYPO3\CMS\Core\Core\Bootstrap
901 * @internal This is not a public API method, do not use in own extensions
902 */
903 public function initializeBackendUser() {
904 /** @var $backendUser \TYPO3\CMS\Core\Authentication\BackendUserAuthentication */
905 $backendUser = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
906 $backendUser->warningEmail = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'];
907 $backendUser->lockIP = $GLOBALS['TYPO3_CONF_VARS']['BE']['lockIP'];
908 $backendUser->auth_timeout_field = intval($GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout']);
909 $backendUser->OS = TYPO3_OS;
910 if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
911 $backendUser->dontSetCookie = TRUE;
912 }
913 // The global must be available very early, because methods below
914 // might triger code which relies on it. See: #45625
915 $GLOBALS['BE_USER'] = $backendUser;
916 $backendUser->start();
917 $backendUser->checkCLIuser();
918 $backendUser->backendCheckLogin();
919 return $this;
920 }
921
922 /**
923 * Initialize backend user mount points
924 *
925 * @return \TYPO3\CMS\Core\Core\Bootstrap
926 * @internal This is not a public API method, do not use in own extensions
927 */
928 public function initializeBackendUserMounts() {
929 // Includes deleted mount pages as well! @TODO: Figure out why ...
930 $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
931 $GLOBALS['BE_USER']->getFileStorages();
932 $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->groupData['filemounts'];
933 return $this;
934 }
935
936 /**
937 * Initialize language object
938 *
939 * @return \TYPO3\CMS\Core\Core\Bootstrap
940 * @internal This is not a public API method, do not use in own extensions
941 */
942 public function initializeLanguageObject() {
943 /** @var $GLOBALS['LANG'] \TYPO3\CMS\Lang\LanguageService */
944 $GLOBALS['LANG'] = Utility\GeneralUtility::makeInstance('TYPO3\CMS\Lang\LanguageService');
945 $GLOBALS['LANG']->init($GLOBALS['BE_USER']->uc['lang']);
946 return $this;
947 }
948
949 /**
950 * Throw away all output that may have happened during bootstrapping by weird extensions
951 *
952 * @return \TYPO3\CMS\Core\Core\Bootstrap
953 * @internal This is not a public API method, do not use in own extensions
954 */
955 public function endOutputBufferingAndCleanPreviousOutput() {
956 ob_clean();
957 return $this;
958 }
959
960 /**
961 * Initialize output compression if configured
962 *
963 * @return \TYPO3\CMS\Core\Core\Bootstrap
964 * @internal This is not a public API method, do not use in own extensions
965 */
966 public function initializeOutputCompression() {
967 if (extension_loaded('zlib') && $GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']) {
968 if (Utility\MathUtility::canBeInterpretedAsInteger($GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel'])) {
969 @ini_set('zlib.output_compression_level', $GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel']);
970 }
971 ob_start('ob_gzhandler');
972 }
973 return $this;
974 }
975
976 /**
977 * Initialize module menu object
978 *
979 * @return \TYPO3\CMS\Core\Core\Bootstrap
980 * @internal This is not a public API method, do not use in own extensions
981 */
982 public function initializeModuleMenuObject() {
983 /** @var $moduleMenuUtility \TYPO3\CMS\Backend\Module\ModuleController */
984 $moduleMenuUtility = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleController');
985 $moduleMenuUtility->createModuleMenu();
986 return $this;
987 }
988
989 /**
990 * Things that should be performed to shut down the framework.
991 * This method is called in all important scripts for a clean
992 * shut down of the system.
993 *
994 * @return \TYPO3\CMS\Core\Core\Bootstrap
995 * @internal This is not a public API method, do not use in own extensions
996 */
997 public function shutdown() {
998 if (PHP_VERSION_ID < 50307) {
999 \TYPO3\CMS\Core\Compatibility\CompatbilityClassLoaderPhpBelow50307::unregisterAutoloader();
1000 } else {
1001 \TYPO3\CMS\Core\Core\ClassLoader::unregisterAutoloader();
1002 }
1003 return $this;
1004 }
1005
1006 /**
1007 * Provides an instance of "template" for backend-modules to
1008 * work with.
1009 *
1010 * @return \TYPO3\CMS\Core\Core\Bootstrap
1011 * @internal This is not a public API method, do not use in own extensions
1012 */
1013 public function initializeBackendTemplate() {
1014 $GLOBALS['TBE_TEMPLATE'] = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
1015 return $this;
1016 }
1017
1018 }
1019
1020
1021 ?>