Bootstrap

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 paths 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!

Table of Contents

Methods

baseSetup()  : mixed
Run the base setup that checks server environment, determines paths, populates base files and sets common configuration.
checkIfEssentialConfigurationExists()  : bool
checks if config/system/settings.php or PackageStates.php is missing, used to see if a redirect to the installer is needed
createCache()  : FrontendInterface
Instantiates an early cache instance
createConfigurationManager()  : ConfigurationManager
We need an early instance of the configuration manager.
createPackageCache()  : PackageCacheInterface
createPackageManager()  : PackageManager
Initializes the package system and loads the package configuration and settings provided by the packages.
init()  : ContainerInterface
Bootstrap TYPO3 and return a Container that may be used to initialize an Application class.
initializeBackendAuthentication()  : mixed
Initializes and ensures authenticated access
initializeBackendUser()  : mixed
Initialize backend user object in globals
initializeClassLoader()  : mixed
Sets the class loader to the bootstrap
loadExtTables()  : mixed
Load ext_tables and friends.
startOutputBuffering()  : mixed
Prevent any unwanted output that may corrupt AJAX/compression.
unsetReservedGlobalVariables()  : mixed
Unsetting reserved global variables: Those are set in "ext:core/ext_tables.php" file:
checkEncryptionKey()  : mixed
Check if a configuration key has been configured
initializeErrorHandling()  : mixed
Configure and set up exception and error handling
populateLocalConfiguration()  : mixed
We need an early instance of the configuration manager.
setDefaultTimezone()  : mixed
Set default timezone
setMemoryLimit()  : mixed
Set PHP memory limit depending on value of $GLOBALS['TYPO3_CONF_VARS']['SYS']['setMemoryLimit']

Methods

baseSetup()

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

public static baseSetup() : mixed

Script execution will be aborted if something fails here.

Internal

This is not a public API method, do not use in own extensions

checkIfEssentialConfigurationExists()

checks if config/system/settings.php or PackageStates.php is missing, used to see if a redirect to the installer is needed

public static checkIfEssentialConfigurationExists(ConfigurationManager $configurationManager) : bool

All file_exists checks are delayed as far as possible to avoid I/O impact

Parameters
$configurationManager : ConfigurationManager
Internal

This is not a public API method, do not use in own extensions

Return values
bool

TRUE when the essential configuration is available, otherwise FALSE

createCache()

Instantiates an early cache instance

public static createCache(string $identifier[, bool $disableCaching = false ]) : FrontendInterface

Creates a cache instances independently from the CacheManager. The is used to create the core cache during early bootstrap when the CacheManager is not yet available (i.e. configuration is not yet loaded).

Parameters
$identifier : string
$disableCaching : bool = false
Internal
Return values
FrontendInterface

createConfigurationManager()

We need an early instance of the configuration manager.

public static createConfigurationManager() : ConfigurationManager

Since makeInstance relies on the object configuration, we create it here with new instead.

Return values
ConfigurationManager

createPackageManager()

Initializes the package system and loads the package configuration and settings provided by the packages.

public static createPackageManager(string $packageManagerClassName, PackageCacheInterface $packageCache) : PackageManager
Parameters
$packageManagerClassName : string

Define an alternative package manager implementation (usually for the installer)

$packageCache : PackageCacheInterface
Internal

This is not a public API method, do not use in own extensions

Return values
PackageManager

init()

Bootstrap TYPO3 and return a Container that may be used to initialize an Application class.

public static init(ClassLoader $classLoader[, bool $failsafe = false ]) : ContainerInterface
Parameters
$classLoader : ClassLoader

an instance of the class loader

$failsafe : bool = false

true if no caching and a failsafe package manager should be used

Return values
ContainerInterface

initializeBackendAuthentication()

Initializes and ensures authenticated access

public static initializeBackendAuthentication() : mixed
Internal

This is not a public API method, do not use in own extensions

initializeBackendUser()

Initialize backend user object in globals

public static initializeBackendUser([string $className = BackendUserAuthentication::class ][, ServerRequestInterface|null $request = null ]) : mixed
Parameters
$className : string = BackendUserAuthentication::class

usually \TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class but can be used for CLI

$request : ServerRequestInterface|null = null
Internal

This is not a public API method, do not use in own extensions

initializeClassLoader()

Sets the class loader to the bootstrap

public static initializeClassLoader(ClassLoader $classLoader) : mixed
Parameters
$classLoader : ClassLoader

an instance of the class loader

Internal

This is not a public API method, do not use in own extensions

loadExtTables()

Load ext_tables and friends.

public static loadExtTables([bool $allowCaching = true ][, FrontendInterface|null $coreCache = null ]) : mixed

This will mainly load and execute ext_tables.php files of loaded extensions or the according cache file if exists.

Parameters
$allowCaching : bool = true

True, if reading compiled ext_tables file from cache is allowed

$coreCache : FrontendInterface|null = null
Internal

This is not a public API method, do not use in own extensions

Tags
todo:

It would be better to remove this method and use the factory directly. Needs a pre-patch in testing-framework.

startOutputBuffering()

Prevent any unwanted output that may corrupt AJAX/compression.

public static startOutputBuffering() : mixed

This does not interfere with "die()" or "echo"+"exit()" messages!

Internal

This is not a public API method, do not use in own extensions

unsetReservedGlobalVariables()

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

public static unsetReservedGlobalVariables() : mixed
Internal

This is not a public API method, do not use in own extensions

checkEncryptionKey()

Check if a configuration key has been configured

protected static checkEncryptionKey() : mixed

initializeErrorHandling()

Configure and set up exception and error handling

protected static initializeErrorHandling() : mixed
Tags
throws
RuntimeException

populateLocalConfiguration()

We need an early instance of the configuration manager.

protected static populateLocalConfiguration(ConfigurationManager $configurationManager) : mixed

Since makeInstance relies on the object configuration, we create it here with new instead.

Parameters
$configurationManager : ConfigurationManager
Internal

This is not a public API method, do not use in own extensions

setDefaultTimezone()

Set default timezone

protected static setDefaultTimezone() : mixed

setMemoryLimit()

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

protected static setMemoryLimit() : mixed

        
On this page

Search results