TYPO3  7.6
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Bootstrap Class Reference

Public Member Functions

 getRequestId ()
 
 getApplicationContext ()
 
 startOutputBuffering ()
 
 configure ()
 
 baseSetup ($relativePathPart= '')
 
 initializeClassLoader ($classLoader)
 
 checkIfEssentialConfigurationExists ()
 
 redirectToInstallTool ($relativePathPart= '')
 
 registerRequestHandlerImplementation ($requestHandler)
 
 handleRequest ($request)
 
 setEarlyInstance ($objectName, $instance)
 
 getEarlyInstance ($objectName)
 
 getEarlyInstances ()
 
 loadConfigurationAndInitialize ($allowCaching=true, $packageManagerClassName=\TYPO3\CMS\Core\Package\PackageManager::class)
 
 ensureClassLoadingInformationExists ()
 
 loadTypo3LoadedExtAndExtLocalconf ($allowCaching=true)
 
 populateLocalConfiguration ()
 
 disableCoreCache ()
 
 initializeCachingFramework ()
 
 setFinalCachingFrameworkCacheConfiguration ()
 
 defineLoggingAndExceptionConstants ()
 
 unsetReservedGlobalVariables ()
 
 checkLockedBackendAndRedirectOrDie ($forceProceeding=false)
 
 checkBackendIpOrDie ()
 
 checkSslBackendAndRedirectIfNeeded ()
 
 loadExtensionTables ($allowCaching=true)
 
 initializeSpriteManager ()
 
 initializeBackendAuthentication ($proceedIfNoUserIsLoggedIn=false)
 
 endOutputBufferingAndCleanPreviousOutput ()
 
 initializeOutputCompression ()
 
 sendHttpHeaders ()
 
 shutdown ()
 
 initializeBackendTemplate ()
 

Static Public Member Functions

static usesComposerClassLoading ()
 
static getInstance ()
 

Protected Member Functions

 __construct ($applicationContext)
 
 __clone ()
 
 sendResponse ()
 
 defineDatabaseConstants ()
 
 defineUserAgentConstant ()
 
 registerExtDirectComponents ()
 
 setCacheHashOptions ()
 
 setDefaultTimezone ()
 
 initializeL10nLocales ()
 
 convertPageNotFoundHandlingToBoolean ()
 
 initializeErrorHandling ()
 
 setMemoryLimit ()
 
 defineTypo3RequestTypes ()
 
 executeExtTablesAdditionalFile ()
 

Protected Attributes

 $requestId
 
 $applicationContext
 
 $earlyInstances = array()
 
 $installToolPath
 
 $availableRequestHandlers = array()
 
 $response
 

Static Protected Attributes

static $instance = null
 
static $usesComposerClassLoading = false
 

Detailed Description

This class encapsulates bootstrap related methods. It is required directly as the very first thing in entry scripts and used to define all base things like constants and pathes and so on.

Most methods in this class have dependencies to each other. They can not be called in arbitrary order. The methods are ordered top down, so a method at the beginning has lower dependencies than a method further down. Do not fiddle with the load order in own scripts except you know exactly what you are doing!

Definition at line 32 of file core/Classes/Core/Bootstrap.php.

Constructor & Destructor Documentation

__construct (   $applicationContext)
protected

Definition at line 87 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\$applicationContext.

Member Function Documentation

__clone ( )
protected

Disable direct cloning of this object.

Definition at line 104 of file core/Classes/Core/Bootstrap.php.

baseSetup (   $relativePathPart = '')

Run the base setup that checks server environment, determines pathes, populates base files and sets common configuration.

Script execution will be aborted if something fails here.

Parameters
string$relativePathPartRelative path of entry script back to document root
Returns
Bootstrap

Definition at line 190 of file core/Classes/Core/Bootstrap.php.

References ClassLoadingInformation\isClassLoadingInformationAvailable(), GeneralUtility\presetApplicationContext(), ClassLoadingInformation\registerClassLoadingInformation(), and SystemEnvironmentBuilder\run().

checkBackendIpOrDie ( )

Compare client IP with IPmaskList and exit the script run if the client is not allowed to access the backend

Returns
Bootstrap

Definition at line 889 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS, GeneralUtility\cmpIP(), and GeneralUtility\getIndpEnv().

checkIfEssentialConfigurationExists ( )

checks if LocalConfiguration.php or PackageStates.php is missing, used to see if a redirect to the install tool is needed

Returns
bool TRUE when the essential configuration is available, otherwise FALSE

Definition at line 223 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\setEarlyInstance().

checkLockedBackendAndRedirectOrDie (   $forceProceeding = false)

Check adminOnly configuration variable and redirects to an URL in file typo3conf/LOCK_BACKEND or exit the script

Exceptions
\RuntimeException
Parameters
bool$forceProceedingif this option is set, the bootstrap will proceed even if the user is logged in (usually only needed for special AJAX cases, see AjaxRequestHandler)
Returns
Bootstrap

Definition at line 864 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS, and GeneralUtility\getUrl().

checkSslBackendAndRedirectIfNeeded ( )

Check lockSSL configuration variable and redirect to https version of the backend if needed

Returns
Bootstrap

Definition at line 907 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS, $server, $url, and GeneralUtility\getIndpEnv().

configure ( )

Main entry point called at every request usually from Global scope. Checks if everything is correct, and loads the Configuration.

Make sure that the baseSetup() is called before and the class loader is present

Returns
Bootstrap

Definition at line 167 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\startOutputBuffering().

convertPageNotFoundHandlingToBoolean ( )
protected

Convert type of "pageNotFound_handling" setting in case it was written as a string (e.g. if edited in Install Tool)

: Remove, if the Install Tool handles such data types correctly

Returns
Bootstrap

Definition at line 651 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS.

defineDatabaseConstants ( )
protected

Define database constants

Returns

Definition at line 514 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS.

defineLoggingAndExceptionConstants ( )

Define logging and exception constants

Returns
Bootstrap

Definition at line 764 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS.

defineTypo3RequestTypes ( )
protected

Define TYPO3_REQUESTTYPE* constants so devs exactly know what type of request it is

Returns
Bootstrap

Definition at line 734 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS.

defineUserAgentConstant ( )
protected

Define user agent constant

Returns

Definition at line 533 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS.

disableCoreCache ( )

Set cache_core to null backend, effectively disabling eg. the cache for ext_localconf and PackageManager etc.

Returns

Definition at line 501 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS.

Referenced by Bootstrap\loadConfigurationAndInitialize().

endOutputBufferingAndCleanPreviousOutput ( )

Throw away all output that may have happened during bootstrapping by weird extensions

Returns
Bootstrap

Definition at line 1163 of file core/Classes/Core/Bootstrap.php.

ensureClassLoadingInformationExists ( )
executeExtTablesAdditionalFile ( )
protected

Execute TYPO3_extTableDef_script if defined and exists

Note: For backwards compatibility some global variables are explicitly set as global to be used without $GLOBALS[] in the extension table script. It is discouraged to access variables like $TBE_MODULES directly, but we can not prohibit this without heavily breaking backwards compatibility.

Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
Returns
void

Definition at line 990 of file core/Classes/Core/Bootstrap.php.

References GeneralUtility\deprecationLog().

Referenced by Bootstrap\loadExtensionTables().

getApplicationContext ( )

Returns the application context this bootstrap was started in.

Returns
The application context encapsulated in an object

Definition at line 141 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\$applicationContext.

getEarlyInstance (   $objectName)

Returns an instance which was registered earlier through setEarlyInstance()

Parameters
string$objectNameObject name of the registered instance
Returns
object
Exceptions
\TYPO3\CMS\Core\Exception

Definition at line 354 of file core/Classes/Core/Bootstrap.php.

Referenced by Bootstrap\populateLocalConfiguration(), and Bootstrap\setFinalCachingFrameworkCacheConfiguration().

getEarlyInstances ( )

Returns all registered early instances indexed by object name

Returns
array

Definition at line 368 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\$earlyInstances.

static getInstance ( )
static
getRequestId ( )

Gets the request's unique ID

Returns
string Unique request ID

Definition at line 129 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\$requestId.

handleRequest (   $request)

Builds a Request instance from the current process, and then resolves the request through the request handlers depending on Frontend, Backend, CLI etc.

Parameters
\Psr\Http\Message\RequestInterface | \Symfony\Component\Console\Input\InputInterface$request
Returns
Bootstrap
Exceptions
\TYPO3\CMS\Core\Exception
\TYPO3\CMS\Extbase\Mvc\Exception\CommandExceptionIs thrown if the response object defined an exit code > 0
Returns
string

Definition at line 295 of file core/Classes/Core/Bootstrap.php.

initializeBackendAuthentication (   $proceedIfNoUserIsLoggedIn = false)

Initializes and ensures authenticated access

Definition at line 1137 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS.

initializeBackendTemplate ( )

Provides an instance of "template" for backend-modules to work with.

Returns
Bootstrap

Definition at line 1223 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS, and GeneralUtility\makeInstance().

initializeCachingFramework ( )

Initialize caching framework, and re-initializes it (e.g. in the install tool) by recreating the instances again despite the Singleton instance

Returns
Bootstrap

Definition at line 578 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS, Bootstrap\setEarlyInstance(), and GeneralUtility\setSingletonInstance().

Referenced by Bootstrap\loadConfigurationAndInitialize().

initializeClassLoader (   $classLoader)

Sets the class loader to the bootstrap

Parameters
\Composer\Autoload\ClassLoader$classLoaderan instance of the class loader
Returns
Bootstrap

Definition at line 207 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\setEarlyInstance().

initializeErrorHandling ( )
protected

Configure and set up exception and error handling

Returns
Bootstrap
Exceptions
\RuntimeException

Definition at line 665 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS, GeneralUtility\cmpIP(), GeneralUtility\deprecationLog(), GeneralUtility\getIndpEnv(), and GeneralUtility\makeInstance().

initializeL10nLocales ( )
protected

Initialize the locales handled by TYPO3

Returns
Bootstrap

Definition at line 638 of file core/Classes/Core/Bootstrap.php.

initializeOutputCompression ( )

Initialize output compression if configured

Returns
Bootstrap

Definition at line 1175 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS, and MathUtility\canBeInterpretedAsInteger().

initializeSpriteManager ( )

Initialize sprite manager

Returns
Bootstrap

Definition at line 1039 of file core/Classes/Core/Bootstrap.php.

loadConfigurationAndInitialize (   $allowCaching = true,
  $packageManagerClassName = \TYPO3\CMS\Core\Package\PackageManager::class 
)

Includes LocalConfiguration.php and sets several global settings depending on configuration.

Parameters
bool$allowCachingWhether to allow caching - affects cache_core (autoloader)
string$packageManagerClassNameDefine an alternative package manager implementation (usually for the installer)
Returns
Bootstrap

Definition at line 382 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\disableCoreCache(), Bootstrap\ensureClassLoadingInformationExists(), Bootstrap\initializeCachingFramework(), and Bootstrap\populateLocalConfiguration().

loadExtensionTables (   $allowCaching = true)

Load ext_tables and friends.

This will mainly set up $TCA and several other global arrays through API's like extMgm. Executes ext_tables.php files of loaded extensions or the according cache file if exists.

Parameters
bool$allowCachingTrue, if reading compiled ext_tables file from cache is allowed
Returns
Bootstrap

Definition at line 969 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\executeExtTablesAdditionalFile().

loadTypo3LoadedExtAndExtLocalconf (   $allowCaching = true)

Load ext_localconf of extensions

Parameters
bool$allowCaching
Returns
Bootstrap

Definition at line 470 of file core/Classes/Core/Bootstrap.php.

populateLocalConfiguration ( )

We need an early instance of the configuration manager. Since makeInstance relies on the object configuration, we create it here with new instead.

Returns
Bootstrap

Definition at line 483 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\getEarlyInstance(), and Bootstrap\setEarlyInstance().

Referenced by Bootstrap\loadConfigurationAndInitialize().

redirectToInstallTool (   $relativePathPart = '')

Redirect to install tool if LocalConfiguration.php is missing.

Definition at line 235 of file core/Classes/Core/Bootstrap.php.

registerExtDirectComponents ( )
protected
registerRequestHandlerImplementation (   $requestHandler)

Adds available request handlers usually done via an application from the outside.

Parameters
string$requestHandlerclass which implements the request handler interface
Returns
Bootstrap

Definition at line 249 of file core/Classes/Core/Bootstrap.php.

sendHttpHeaders ( )

Send HTTP headers if configured

Returns
Bootstrap

Definition at line 1192 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS.

sendResponse ( )
protected

Outputs content if there is a proper Response object.

Returns
Bootstrap

Definition at line 311 of file core/Classes/Core/Bootstrap.php.

Referenced by Bootstrap\shutdown().

setCacheHashOptions ( )
protected

Set cacheHash options

Returns
Bootstrap

Definition at line 596 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS, and GeneralUtility\trimExplode().

setDefaultTimezone ( )
protected

Set default timezone

Returns
Bootstrap

Definition at line 616 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS.

setEarlyInstance (   $objectName,
  $instance 
)

Registers the instance of the specified object for an early boot stage. On finalizing the Object Manager initialization, all those instances will be transferred to the Object Manager's registry.

Parameters
string$objectNameObject name, as later used by the Object Manager
object$instanceThe instance to register
Returns
void

Definition at line 341 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\$instance.

Referenced by Bootstrap\checkIfEssentialConfigurationExists(), Bootstrap\initializeCachingFramework(), Bootstrap\initializeClassLoader(), and Bootstrap\populateLocalConfiguration().

setFinalCachingFrameworkCacheConfiguration ( )

Extensions may register new caches, so we set the global cache array to the manager again at this point

Returns
Bootstrap

Definition at line 752 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS, and Bootstrap\getEarlyInstance().

setMemoryLimit ( )
protected

Set PHP memory limit depending on value of $GLOBALS['TYPO3_CONF_VARS']['SYS']['setMemoryLimit']

Returns
Bootstrap

Definition at line 720 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS.

shutdown ( )

Things that should be performed to shut down the framework. This method is called in all important scripts for a clean shut down of the system.

Returns
Bootstrap

Definition at line 1210 of file core/Classes/Core/Bootstrap.php.

References Bootstrap\sendResponse().

startOutputBuffering ( )

Prevent any unwanted output that may corrupt AJAX/compression. This does not interfere with "die()" or "echo"+"exit()" messages!

Returns
Bootstrap

Definition at line 153 of file core/Classes/Core/Bootstrap.php.

Referenced by Bootstrap\configure().

unsetReservedGlobalVariables ( )

Unsetting reserved global variables: Those are set in "ext:core/ext_tables.php" file:

Returns
Bootstrap

Definition at line 779 of file core/Classes/Core/Bootstrap.php.

References $GLOBALS.

static usesComposerClassLoading ( )
static

Member Data Documentation

$applicationContext
protected
$availableRequestHandlers = array()
protected

Definition at line 67 of file core/Classes/Core/Bootstrap.php.

$earlyInstances = array()
protected

Definition at line 56 of file core/Classes/Core/Bootstrap.php.

Referenced by Bootstrap\getEarlyInstances().

$installToolPath
protected

Definition at line 61 of file core/Classes/Core/Bootstrap.php.

$instance = null
staticprotected

Definition at line 37 of file core/Classes/Core/Bootstrap.php.

Referenced by Bootstrap\setEarlyInstance().

$requestId
protected

Definition at line 44 of file core/Classes/Core/Bootstrap.php.

Referenced by Bootstrap\getRequestId().

$response
protected

Definition at line 74 of file core/Classes/Core/Bootstrap.php.

$usesComposerClassLoading = false
staticprotected

Definition at line 79 of file core/Classes/Core/Bootstrap.php.