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