diff --git a/index.php b/index.php index 0a21a026b5d3b3050b2588fd3086316a2a874662..b292d5a95283a175488cf4d4c581db56f3654a49 100644 --- a/index.php +++ b/index.php @@ -34,10 +34,10 @@ * @subpackage tslib */ - // We use require instead of require_once here so we get a fatal error if classes/Bootstrap/Backend.php is accidentally included twice + // We use require instead of require_once here so we get a fatal error if classes/Bootstrap.php is accidentally included twice // (which would indicate a clear bug). -require('typo3/classes/Bootstrap/Backend.php'); -Typo3_Bootstrap_Backend::getInstance() +require('typo3/classes/Bootstrap.php'); +Typo3_Bootstrap::getInstance() ->checkEnvironmentOrDie() ->defineBaseConstants() ->defineAndCheckPaths('') diff --git a/tests/Unit/typo3/classes/BootstrapTest.php b/tests/Unit/typo3/classes/BootstrapTest.php deleted file mode 100644 index 60291ee4d7888ba1b4f3e8b9c37f51cdd98e833d..0000000000000000000000000000000000000000 --- a/tests/Unit/typo3/classes/BootstrapTest.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/*************************************************************** - * Copyright notice - * - * (c) 2012 Oliver Hader <oliver.hader@typo3.org> - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * A copy is found in the textfile GPL.txt and important notices to the license - * from the author is found in LICENSE.txt distributed with these scripts. - * - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - ***************************************************************/ - -require_once PATH_typo3 . 'classes/Bootstrap/Abstract.php'; -require_once PATH_typo3 . 'classes/Bootstrap/Backend.php'; -require_once PATH_typo3 . 'classes/Bootstrap/Cli.php'; -require_once PATH_typo3 . 'classes/Bootstrap/Install.php'; - -/** - * @author Oliver Hader <oliver.hader@typo3.org> - * @package TYPO3 - * @subpackage core - */ -class Typo3_Bootstrap_BackendTest extends Tx_PhpUnit_TestCase { - /** - * @test - */ - public function areDifferentBootstrapObjectsCorrect() { - $backend = Typo3_Bootstrap_Backend::getInstance(); - $cli = Typo3_Bootstrap_Cli::getInstance(); - $install = Typo3_Bootstrap_Install::getInstance(); - - $this->assertInstanceOf('Typo3_Bootstrap_Backend', $backend); - $this->assertInstanceOf('Typo3_Bootstrap_Cli', $cli); - $this->assertInstanceOf('Typo3_Bootstrap_Install', $install); - } -} -?> \ No newline at end of file diff --git a/typo3/backend.php b/typo3/backend.php index 46ba85a448dbc72b8276b29f7a3a9d55216af866..c3131043e1aba679efac1402fbe8244bfa34f60c 100644 --- a/typo3/backend.php +++ b/typo3/backend.php @@ -833,6 +833,6 @@ if (is_array($GLOBALS['TBE_MODULES']['_configuration'])) { $TYPO3backend->render(); -Typo3_Bootstrap_Backend::getInstance()->shutdown(); +Typo3_Bootstrap::getInstance()->shutdown(); ?> \ No newline at end of file diff --git a/typo3/classes/Bootstrap/Backend.php b/typo3/classes/Bootstrap.php similarity index 96% rename from typo3/classes/Bootstrap/Backend.php rename to typo3/classes/Bootstrap.php index b749c2797918e5966a5c75617c4393d2ba1516ed..d4da17b30c4926f3fbb1c593abdeac3a53a2066f 100644 --- a/typo3/classes/Bootstrap/Backend.php +++ b/typo3/classes/Bootstrap.php @@ -25,8 +25,6 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -require_once __DIR__ . DIRECTORY_SEPARATOR . 'Abstract.php'; - /** * This class encapsulates bootstrap related methods. * It is required directly as the very first thing in entry scripts and @@ -42,18 +40,30 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'Abstract.php'; * @package TYPO3 * @subpackage core */ -class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { +class Typo3_Bootstrap { /** - * @var Typo3_Bootstrap_Backend + * @var Typo3_Bootstrap */ protected static $instance = NULL; /** - * @return Typo3_Bootstrap_Backend + * Disable direct creation of this object. + */ + protected function __construct() { + } + + /** + * Disable direct cloning of this object. + */ + protected function __clone() { + } + + /** + * @return Typo3_Bootstrap */ public static function getInstance() { if (is_null(self::$instance)) { - self::$instance = new Typo3_Bootstrap_Backend(); + self::$instance = new Typo3_Bootstrap(); } return self::$instance; } @@ -62,7 +72,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Check several a priori conditions like the current * php version or exit the script with an error. * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function checkEnvironmentOrDie() { $this->checkPhpVersionOrDie(); @@ -74,7 +84,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Define all simple base constants * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function defineBaseConstants() { // This version, branch and copyright @@ -125,7 +135,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * The script execution will be aborted if this fails. * * @param string $relativePathPart The relative path of the entry script to the document root - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function defineAndCheckPaths($relativePathPart = '') { // Relative path from document root to typo3/ directory @@ -173,7 +183,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Load several base classes during bootstrap * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function requireBaseClasses() { require_once(PATH_t3lib . 'class.t3lib_div.php'); @@ -205,7 +215,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Set up php error reporting and various things like time tracking * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function setUpEnvironment() { // Core should be notice free at least until this point ... @@ -238,7 +248,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Load default TYPO3_CONF_VARS * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function loadDefaultTypo3ConfVars() { $GLOBALS['TYPO3_CONF_VARS'] = require(PATH_t3lib . 'stddb/DefaultSettings.php'); @@ -249,7 +259,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Register default ExtDirect components * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function registerExtDirectComponents() { if (TYPO3_MODE === 'BE') { @@ -303,7 +313,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Initialize some globals * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function initializeGlobalVariables() { $GLOBALS['T3_VAR'] = array(); @@ -316,7 +326,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Check typo3conf/localconf.php exists * * @throws RuntimeException - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function checkLocalconfExistsOrDie() { if (!@is_file(PATH_typo3conf . 'localconf.php')) { @@ -331,7 +341,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Database-variables are cleared! * * @TODO: Figure out why we do this (security reasons with register globals?) - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function setGlobalDatabaseVariablesToEmptyString() { // The database name @@ -353,7 +363,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Loads the main configuration file (localconf.php) * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function loadMainConfigurationFile() { global $TYPO3_CONF_VARS, $typo_db, $typo_db_username, $typo_db_password, $typo_db_host, $typo_db_extTableDef_script; @@ -366,7 +376,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Define the database setup as constants * and unset no longer needed global variables * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function defineTypo3DatabaseConstants() { define('TYPO3_db', $GLOBALS['typo_db']); @@ -388,7 +398,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Initialize caching framework * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function initializeCachingFramework() { t3lib_cache::initializeCachingFramework(); @@ -399,7 +409,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Register autoloader * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function registerAutoloader() { t3lib_autoloader::registerAutoloader(); @@ -419,7 +429,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * thus avoiding any incompatibilities with newer or older * versions. * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function addCorePearPathToIncludePath() { set_include_path(PATH_typo3 . 'contrib/pear/' . PATH_SEPARATOR . get_include_path()); @@ -436,7 +446,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * [SYS][setDBinit] is used to set the DB connection * and both settings need to be adjusted for UTF-8 in order to work properly * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function checkUtf8DatabaseSettingsOrDie() { // Check if [BE][forceCharset] has been set in localconf.php @@ -478,7 +488,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Parse old curl options and set new http ones instead * * @TODO: This code segment must still be finished - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function transferDeprecatedCurlSettings() { if (!empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer'])) { @@ -510,7 +520,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Set cacheHash options * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function setCacheHashOptions() { $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash'] = array( @@ -531,7 +541,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * $GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_auth_scheme'] must be either * 'digest' or 'basic' with fallback to 'basic' * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function enforceCorrectProxyAuthScheme() { $GLOBALS['TYPO3_CONF_VARS']['HTTP']['proxy_auth_scheme'] === 'digest' ? @@ -543,7 +553,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Set default timezone * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function setDefaultTimezone() { $timeZone = $GLOBALS['TYPO3_CONF_VARS']['SYS']['phpTimeZone']; @@ -565,7 +575,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Initialize the locales handled by TYPO3 * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function initializeL10nLocales() { t3lib_l10n_Locales::initialize(); @@ -577,7 +587,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Based on the configuration of the image processing some options are forced * to simplify configuration settings and combinations * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function configureImageProcessingOptions() { if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['image_processing']) { @@ -613,7 +623,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * string (e.g. if edited in Install Tool) * * @TODO: Remove, if the Install Tool handles such data types correctly - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function convertPageNotFoundHandlingToBoolean() { if (!strcasecmp($GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'], 'TRUE')) { @@ -629,7 +639,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Note: Yes, this is possible in php! xdebug() is then a global function, even * if registerGlobalDebugFunctions() is encapsulated in class scope. * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function registerGlobalDebugFunctions() { // Simple debug function which prints output immediately @@ -676,7 +686,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Mail sending via Swift Mailer * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function registerSwiftMailer() { $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery'][] @@ -688,7 +698,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Configure and set up exception and error handling * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function configureExceptionHandling() { $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['errors']['exceptionHandler'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler']; @@ -725,7 +735,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Set PHP memory limit depending on value of * $GLOBALS['TYPO3_CONF_VARS']['SYS']['setMemoryLimit'] * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function setMemoryLimit() { if (intval($GLOBALS['TYPO3_CONF_VARS']['SYS']['setMemoryLimit']) > 16) { @@ -739,7 +749,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Define TYPO3_REQUESTTYPE* constants * so devs exactly know what type of request it is * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function defineTypo3RequestTypes() { define('TYPO3_REQUESTTYPE_FE', 1); @@ -764,7 +774,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * The ext_localconf.php files in extensions are meant to make changes * to the global $TYPO3_CONF_VARS configuration array. * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function loadAdditionalConfigurationFromExtensions() { // This is the main array meant to be manipulated in the ext_localconf.php files @@ -805,7 +815,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Write deprecation log if the TYPO3 instance uses deprecated XCLASS * registrations via $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS'] * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function deprecationLogForOldXclassRegistration() { if (count($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']) > 0) { @@ -822,7 +832,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Initialize exception handling * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function initializeExceptionHandling() { if ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['errors']['exceptionHandler'] !== '') { @@ -846,7 +856,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Load some additional classes that are encapsulated in extensions * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function requireAdditionalExtensionFiles() { require_once(t3lib_extMgm::extPath('lang') . 'lang.php'); @@ -858,7 +868,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Extensions may register new caches, so we set the * global cache array to the manager again at this point * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function setFinalCachingFrameworkCacheConfiguration() { $GLOBALS['typo3CacheManager']->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']); @@ -869,7 +879,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Define logging and exception constants * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function defineLoggingAndExceptionConstants() { define('TYPO3_DLOG', $GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']); @@ -883,7 +893,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Unsetting reserved global variables: * Those which are/can be set in "stddb/tables.php" files: * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function unsetReservedGlobalVariables() { unset($GLOBALS['PAGES_TYPES']); @@ -909,7 +919,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Initialize some global time variables * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function initializeGlobalTimeVariables() { // $EXEC_TIME is set so that the rest of the script has a common value for the script execution time @@ -929,7 +939,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Initialize t3lib_db in $GLOBALS and connect if requested * * @param bool $connect Whether or not the db should be connected already - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function initializeTypo3DbGlobal($connect = TRUE) { /** @var TYPO3_DB t3lib_db */ @@ -947,7 +957,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * to an URL in file typo3conf/LOCK_BACKEND or exit the script * * @throws RuntimeException - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function checkLockedBackendAndRedirectOrDie() { if ($GLOBALS['TYPO3_CONF_VARS']['BE']['adminOnly'] < 0) { @@ -980,7 +990,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Compare client IP with IPmaskList and exit the script run * if the client is not allowed to access the backend * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function checkBackendIpOrDie() { if (trim($GLOBALS['TYPO3_CONF_VARS']['BE']['IPmaskList'])) { @@ -1001,7 +1011,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Check lockSSL configuration variable and redirect * to https version of the backend if needed * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function checkSslBackendAndRedirectIfNeeded() { if (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'])) { @@ -1058,7 +1068,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * * @TODO: It should be defined, which global arrays are ok to be manipulated * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function loadExtensionTables() { global $T3_SERVICES, $T3_VAR, $TYPO3_CONF_VARS; @@ -1101,7 +1111,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Check for registered ext tables hooks and run them * * @throws UnexpectedValueException - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ protected function runExtTablesPostProcessingHooks() { if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['extTablesInclusion-PostProcessing'])) { @@ -1122,7 +1132,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * Initialize sprite manager global * * @param bool $allowRegeneration - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function initializeSpriteManager($allowRegeneration = TRUE) { /** @var $spriteManager t3lib_SpriteManager */ @@ -1135,7 +1145,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Initialize backend user object in globals * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function initializeBackendUser() { /** @var $backendUser t3lib_beUserAuth */ @@ -1158,7 +1168,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Initialize backend user mount points * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function initializeBackendUserMounts() { // Includes deleted mount pages as well! @TODO: Figure out why ... @@ -1171,7 +1181,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { /** * Initialize language object * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function initializeLanguageObject() { /** @var $GLOBALS['LANG'] language */ @@ -1186,7 +1196,7 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract { * This method is called in all important scripts for a clean * shut down of the system. * - * @return Typo3_Bootstrap_Backend + * @return Typo3_Bootstrap */ public function shutdown() { t3lib_autoloader::unregisterAutoloader(); diff --git a/typo3/classes/Bootstrap/Abstract.php b/typo3/classes/Bootstrap/Abstract.php deleted file mode 100644 index c728fff4d30f986954fb21ea31024007370bef5f..0000000000000000000000000000000000000000 --- a/typo3/classes/Bootstrap/Abstract.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/*************************************************************** - * Copyright notice - * - * (c) 2012 Oliver Hader <oliver.hader@typo3.org> - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * A copy is found in the textfile GPL.txt and important notices to the license - * from the author is found in LICENSE.txt distributed with these scripts. - * - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - ***************************************************************/ - -/** - * This class is the abstract representation of all concreate - * TYPO3 bootstrap implementations. - * - * @author Oliver Hader <oliver.hader@typo3.org> - * @package TYPO3 - * @subpackage core - */ -abstract class Typo3_Bootstrap_Abstract { - /** - * Disables direct creation of this object. - */ - protected function __construct() { - } - - /** - * Disables direct cloning of this object. - */ - protected function __clone() { - } - - /** - * @return Typo3_Bootstrap_Abstract - */ - abstract public static function getInstance(); -} -?> \ No newline at end of file diff --git a/typo3/classes/Bootstrap/Cli.php b/typo3/classes/Bootstrap/Cli.php index b09bafcf412944af90e62d3a72819fce2b491347..2914960064e4b6d5a6e35aa2781c23294ab490ac 100644 --- a/typo3/classes/Bootstrap/Cli.php +++ b/typo3/classes/Bootstrap/Cli.php @@ -25,8 +25,6 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -require_once __DIR__ . DIRECTORY_SEPARATOR . 'Abstract.php'; - /** * This class encapsulates cli specific bootstrap methods. * @@ -34,35 +32,18 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'Abstract.php'; * @package TYPO3 * @subpackage core */ -class Typo3_Bootstrap_Cli extends Typo3_Bootstrap_Abstract { - /** - * @var Typo3_Bootstrap_Cli - */ - protected static $instance = NULL; - - /** - * @return Typo3_Bootstrap_Cli - */ - public static function getInstance() { - if (is_null(self::$instance)) { - self::$instance = new Typo3_Bootstrap_Cli(); - } - return self::$instance; - } - +class Typo3_Bootstrap_Cli { /** * Check the script is called from a cli environment. * - * @return Typo3_Bootstrap_Cli + * @return void */ - public function checkEnvironmentOrDie() { + public static function checkEnvironmentOrDie() { if (substr(php_sapi_name(), 0, 3) === 'cgi') { - $this->initializeCgiCompatibilityLayerOrDie(); + self::initializeCgiCompatibilityLayerOrDie(); } elseif (php_sapi_name() !== 'cli') { die('Not called from a command line interface (e.g. a shell or scheduler).' . chr(10)); } - - return $this; } /** @@ -70,9 +51,9 @@ class Typo3_Bootstrap_Cli extends Typo3_Bootstrap_Abstract { * First argument is a key that points to the script configuration. * If it is not set or not valid, the script exits with an error message. * - * @return Typo3_Bootstrap_Cli + * @return void */ - public function initializeCliKeyOrDie() { + public static function initializeCliKeyOrDie() { if ( !isset($_SERVER['argv'][1]) || !is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys'][$_SERVER['argv'][1]]) @@ -103,8 +84,6 @@ class Typo3_Bootstrap_Cli extends Typo3_Bootstrap_Abstract { $GLOBALS['temp_cliScriptPath'] = array_shift($_SERVER['argv']); $GLOBALS['temp_cliKey'] = array_shift($_SERVER['argv']); array_unshift($_SERVER['argv'], $GLOBALS['temp_cliScriptPath']); - - return $this; } /** @@ -113,7 +92,7 @@ class Typo3_Bootstrap_Cli extends Typo3_Bootstrap_Abstract { * * @return void */ - protected function initializeCgiCompatibilityLayerOrDie() { + protected static function initializeCgiCompatibilityLayerOrDie() { // Sanity check: Ensure we're running in a shell or cronjob (and NOT via HTTP) $checkEnvVars = array('HTTP_USER_AGENT', 'HTTP_HOST', 'SERVER_NAME', 'REMOTE_ADDR', 'REMOTE_PORT', 'SERVER_PROTOCOL'); foreach ($checkEnvVars as $var) { diff --git a/typo3/classes/Bootstrap/Install.php b/typo3/classes/Bootstrap/Install.php index aeef81c1eaa571e65a5c88f10bda38ee6dcdf240..7aa053228532fae77d8a97d9ec797e20b66e7a07 100644 --- a/typo3/classes/Bootstrap/Install.php +++ b/typo3/classes/Bootstrap/Install.php @@ -25,8 +25,6 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -require_once __DIR__ . DIRECTORY_SEPARATOR . 'Abstract.php'; - /** * Encapsulate install tool specific bootstrap methods. * @@ -34,29 +32,14 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'Abstract.php'; * @package TYPO3 * @subpackage core */ -class Typo3_Bootstrap_Install extends Typo3_Bootstrap_Abstract { - /** - * @var Typo3_Bootstrap_Install - */ - protected static $instance = NULL; - - /** - * @return Typo3_Bootstrap_Install - */ - public static function getInstance() { - if (is_null(self::$instance)) { - self::$instance = new Typo3_Bootstrap_Install(); - } - return self::$instance; - } - +class Typo3_Bootstrap_Install { /** * Check ENABLE_INSTALL_TOOL and FIRST_INSTALL file in typo3conf * or exit the scipt if conditions to access the install tool are not met. * - * @return Typo3_Bootstrap_Install + * @return void */ - public function checkEnabledInstallToolOrDie() { + public static function checkEnabledInstallToolOrDie() { $quickstartFile = PATH_site . 'typo3conf/FIRST_INSTALL'; $enableInstallToolFile = PATH_site . 'typo3conf/ENABLE_INSTALL_TOOL'; @@ -83,10 +66,8 @@ class Typo3_Bootstrap_Install extends Typo3_Bootstrap_Abstract { } if (!is_file($enableInstallToolFile) || $removeInstallToolFileFailed) { - $this->dieWithLockedInstallToolMessage(); + self::dieWithLockedInstallToolMessage(); } - - return $this; } /** @@ -94,7 +75,7 @@ class Typo3_Bootstrap_Install extends Typo3_Bootstrap_Abstract { * * @return void */ - protected function dieWithLockedInstallToolMessage() { + protected static function dieWithLockedInstallToolMessage() { require_once(PATH_site . 't3lib/class.t3lib_parsehtml.php'); // Define the stylesheet diff --git a/typo3/cli_dispatch.phpsh b/typo3/cli_dispatch.phpsh index 74509052b0178f5bc991cfb5cfcf9ce492dd14fd..657b270fe741603ce0647654156b5d7806794aa0 100755 --- a/typo3/cli_dispatch.phpsh +++ b/typo3/cli_dispatch.phpsh @@ -40,13 +40,13 @@ define('TYPO3_MODE','BE'); define('TYPO3_cliMode', TRUE); - // We use require instead of require_once here so we get a fatal error if classes/Bootstrap/Backend.php is accidentally included twice + // We use require instead of require_once here so we get a fatal error if classes/Bootstrap.php is accidentally included twice // (which would indicate a clear bug). require('classes/Bootstrap/Cli.php'); -Typo3_Bootstrap_Cli::getInstance()->checkEnvironmentOrDie(); +Typo3_Bootstrap_Cli::checkEnvironmentOrDie(); -require('classes/Bootstrap/Backend.php'); -Typo3_Bootstrap_Backend::getInstance() +require('classes/Bootstrap.php'); +Typo3_Bootstrap::getInstance() ->checkEnvironmentOrDie() ->defineBaseConstants() ->defineAndCheckPaths('typo3/') @@ -84,8 +84,8 @@ Typo3_Bootstrap_Backend::getInstance() ->unsetReservedGlobalVariables() ->initializeGlobalTimeVariables() ->initializeTypo3DbGlobal(TRUE); -Typo3_Bootstrap_Cli::getInstance()->initializeCliKeyOrDie(); -Typo3_Bootstrap_Backend::getInstance() +Typo3_Bootstrap_Cli::initializeCliKeyOrDie(); +Typo3_Bootstrap::getInstance() ->loadExtensionTables() // TODO: Check if we really need the sprite manager on the command line ->initializeSpriteManager(TRUE) @@ -103,5 +103,5 @@ try { exit(99); } -Typo3_Bootstrap_Backend::getInstance()->shutdown(); +Typo3_Bootstrap::getInstance()->shutdown(); ?> \ No newline at end of file diff --git a/typo3/init.php b/typo3/init.php index 25d8e925e49105ff047f0fc7c4354f84b8d5eb41..32f5907331f7a6ba9b181f7cc6a14bc40b1bb5b5 100644 --- a/typo3/init.php +++ b/typo3/init.php @@ -63,9 +63,9 @@ ob_start(); define('TYPO3_MODE', 'BE'); // We use require instead of require_once here so we get a fatal error if - // classes/Bootstrap/Backend.php is accidentally included twice (which would indicate a clear bug). -require('classes/Bootstrap/Backend.php'); -Typo3_Bootstrap_Backend::getInstance() + // classes/Bootstrap.php is accidentally included twice (which would indicate a clear bug). +require('classes/Bootstrap.php'); +Typo3_Bootstrap::getInstance() ->checkEnvironmentOrDie() ->defineBaseConstants() ->defineAndCheckPaths('typo3/') @@ -120,7 +120,7 @@ if (!$CLIENT['BROWSER']) { throw new RuntimeException('Browser Error: Your browser version looks incompatible with this TYPO3 version!', 1294587023); } -Typo3_Bootstrap_Backend::getInstance() +Typo3_Bootstrap::getInstance() ->loadExtensionTables() ->initializeSpriteManager(TRUE) ->initializeBackendUser() diff --git a/typo3/install/index.php b/typo3/install/index.php index 49dddd883d851024a1170be1b92dce2754a1ae6f..de8455f7d24422b5fdbe6b92806281f88494f99f 100755 --- a/typo3/install/index.php +++ b/typo3/install/index.php @@ -37,10 +37,10 @@ ob_start(); define('TYPO3_MODE', 'BE'); define('TYPO3_enterInstallScript', '1'); - // We use require instead of require_once here so we get a fatal error if classes/Bootstrap/Backend.php is accidentally included twice + // We use require instead of require_once here so we get a fatal error if classes/Bootstrap.php is accidentally included twice // (which would indicate a clear bug). -require('../classes/Bootstrap/Backend.php'); -Typo3_Bootstrap_Backend::getInstance() +require('../classes/Bootstrap.php'); +Typo3_Bootstrap::getInstance() ->checkEnvironmentOrDie() ->defineBaseConstants() ->defineAndCheckPaths('typo3/install/') @@ -48,9 +48,9 @@ Typo3_Bootstrap_Backend::getInstance() ->setUpEnvironment(); require('../classes/Bootstrap/Install.php'); -Typo3_Bootstrap_Install::getInstance()->checkEnabledInstallToolOrDie(); +Typo3_Bootstrap_Install::checkEnabledInstallToolOrDie(); -Typo3_Bootstrap_Backend::getInstance() +Typo3_Bootstrap::getInstance() ->loadDefaultTypo3ConfVars() ->registerExtDirectComponents() ->initializeGlobalVariables() diff --git a/typo3/mod.php b/typo3/mod.php index 11ec3f592560bd20457dbd51ad2c3df9740678f3..06db2f2fb7f5fdd5a2429b8299b392b75ac3ad19 100644 --- a/typo3/mod.php +++ b/typo3/mod.php @@ -62,6 +62,6 @@ if ($isDispatched === FALSE) { throw new UnexpectedValueException('No module "' . htmlspecialchars($temp_M) . '" could be found.', 1294585070); } -Typo3_Bootstrap_Backend::getInstance()->shutdown(); +Typo3_Bootstrap::getInstance()->shutdown(); ?> \ No newline at end of file diff --git a/typo3/sysext/cms/tslib/class.tslib_fe.php b/typo3/sysext/cms/tslib/class.tslib_fe.php index 66c99d4c0ac3aa41da34635ad4343b33c9a18277..bbff3240d5be35fd5adad568a09c4fbdfb82f026 100644 --- a/typo3/sysext/cms/tslib/class.tslib_fe.php +++ b/typo3/sysext/cms/tslib/class.tslib_fe.php @@ -2077,7 +2077,7 @@ class tslib_fe { public function includeTCA($TCAloaded = 1) { if (!$this->TCAloaded) { $GLOBALS['TCA'] = array(); - Typo3_Bootstrap_Backend::getInstance()->loadExtensionTables(); + Typo3_Bootstrap::getInstance()->loadExtensionTables(); $this->TCAloaded = $TCAloaded; } } diff --git a/typo3/sysext/cms/tslib/index_ts.php b/typo3/sysext/cms/tslib/index_ts.php index 41e22ec294bf0d9412c1f396b769edb0306fe126..e1505dbd882f415298040fc5e891493e15f06b5b 100644 --- a/typo3/sysext/cms/tslib/index_ts.php +++ b/typo3/sysext/cms/tslib/index_ts.php @@ -45,7 +45,7 @@ define('TYPO3_MODE', 'FE'); // AJAX/compression data corruption ob_start(); -Typo3_Bootstrap_Backend::getInstance()->loadDefaultTypo3ConfVars() +Typo3_Bootstrap::getInstance()->loadDefaultTypo3ConfVars() ->registerExtDirectComponents() ->initializeGlobalVariables() ->checkLocalconfExistsOrDie() @@ -91,7 +91,7 @@ if ($_COOKIE[t3lib_beUserAuth::getCookieName()]) { } $TT->start(); -Typo3_Bootstrap_Backend::getInstance()->initializeTypo3DbGlobal(FALSE); +Typo3_Bootstrap::getInstance()->initializeTypo3DbGlobal(FALSE); // Hook to preprocess the current request: if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'])) { @@ -187,11 +187,11 @@ $TT->pull(); // Admin Panel & Frontend editing if ($TSFE->isBackendUserLoggedIn()) { - Typo3_Bootstrap_Backend::getInstance()->initializeSpriteManager(FALSE); + Typo3_Bootstrap::getInstance()->initializeSpriteManager(FALSE); $BE_USER->initializeFrontendEdit(); if ($BE_USER->adminPanel instanceof tslib_AdminPanel) { - Typo3_Bootstrap_Backend::getInstance()->initializeLanguageObject(); + Typo3_Bootstrap::getInstance()->initializeLanguageObject(); } if ($BE_USER->frontendEdit instanceof t3lib_frontendedit) { $BE_USER->frontendEdit->initConfigOptions(); @@ -322,6 +322,6 @@ if (TYPO3_DLOG) { t3lib_div::devLog('END of FRONTEND session', 'cms', 0, array('_FLUSH' => TRUE)); } -Typo3_Bootstrap_Backend::getInstance()->shutdown(); +Typo3_Bootstrap::getInstance()->shutdown(); ?> \ No newline at end of file diff --git a/typo3/sysext/install/mod/class.tx_install.php b/typo3/sysext/install/mod/class.tx_install.php index 0a140955e13fb7ff0e596c0fd2da1af821e74d97..2d9dd260538469658d9dc3bd6180848298065b1a 100644 --- a/typo3/sysext/install/mod/class.tx_install.php +++ b/typo3/sysext/install/mod/class.tx_install.php @@ -7495,7 +7495,7 @@ $out=" * @return void */ function includeTCA() { - Typo3_Bootstrap_Backend::getInstance()->loadExtensionTables(); + Typo3_Bootstrap::getInstance()->loadExtensionTables(); foreach ($GLOBALS['TCA'] as $table => $conf) { t3lib_div::loadTCA($table); diff --git a/typo3/sysext/install/updates/class.tx_coreupdates_migrateworkspaces.php b/typo3/sysext/install/updates/class.tx_coreupdates_migrateworkspaces.php index 30b9c7a9bde86b1ae64c45364d9c6ca490232070..2824c0fd9ce9d373e0559577a0ed0c0288e6d869 100644 --- a/typo3/sysext/install/updates/class.tx_coreupdates_migrateworkspaces.php +++ b/typo3/sysext/install/updates/class.tx_coreupdates_migrateworkspaces.php @@ -64,7 +64,7 @@ class tx_coreupdates_migrateworkspaces extends tx_coreupdates_installsysexts { install "fluid" and "extbase" too, as they are used by the "workspaces" extension).'; } else { - Typo3_Bootstrap_Backend::getInstance()->loadExtensionTables(); + Typo3_Bootstrap::getInstance()->loadExtensionTables(); if (!t3lib_extMgm::isLoaded('version') || !t3lib_extMgm::isLoaded('workspaces')) { $result = TRUE; @@ -153,7 +153,7 @@ class tx_coreupdates_migrateworkspaces extends tx_coreupdates_installsysexts { return TRUE; } - Typo3_Bootstrap_Backend::getInstance()->loadExtensionTables(); + Typo3_Bootstrap::getInstance()->loadExtensionTables(); // install version and workspace extension (especially when updating from very old TYPO3 versions $this->installExtensions(array('extbase', 'fluid', 'version', 'workspaces'));