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