All Classes Namespaces Files Functions Variables Pages
SystemEnvironmentBuilder Class Reference

Static Public Member Functions

static run ($entryPointLevel=0)
static isFunctionDisabled ($function)

Static Protected Member Functions

static defineBaseConstants ()
static definePaths ($entryPointLevel=0)
static checkMainPathsExist ()
static initializeGlobalVariables ()
static initializeGlobalTimeTrackingVariables ()
static initializeBasicErrorReporting ()
static getTypo3Os ()
static getPathThisScript ()
static getPathThisScriptNonCli ()
static getPathThisScriptCli ()
static getPathSite ($entryPointLevel)
static getUnifiedDirectoryName ($absolutePath)
static exitWithMessage ($message)

Static Protected Attributes

static $supportedCgiServerApis
static $disabledFunctions = null

Detailed Description

Class to encapsulate base setup of bootstrap.

This class contains all code that must be executed by every entry script.

It sets up all basic paths, constants, global variables and checks the basic environment TYPO3 runs in.

This class does not use any TYPO3 instance specific configuration, it only sets up things based on the server environment and core code. Even with a missing typo3conf/localconf.php this script will be successful.

The script aborts execution with an error message if some part fails or conditions are not met.

This script is internal code and subject to change. DO NOT use it in own code, or be prepared your code might break in future versions of the core.

Definition at line 38 of file SystemEnvironmentBuilder.php.

Member Function Documentation

static checkMainPathsExist ( )

Check if path and script file name calculation was successful, exit if not.


Definition at line 182 of file SystemEnvironmentBuilder.php.

static defineBaseConstants ( )

Define all simple constants that have no dependency to local configuration


Definition at line 85 of file SystemEnvironmentBuilder.php.

static definePaths (   $entryPointLevel = 0)

Calculate all required base paths and set as constants.

int$entryPointLevelNumber of subdirectories where the entry script is located under the document root

Definition at line 152 of file SystemEnvironmentBuilder.php.

static exitWithMessage (   $message)

Send http headers, echo out a text message and exit with error code


Definition at line 403 of file SystemEnvironmentBuilder.php.

References HttpUtility\HTTP_STATUS_500.

static getPathSite (   $entryPointLevel)

Calculate the document root part to the instance from PATH_thisScript. This is based on the amount of subdirectories "under" PATH_site where PATH_thisScript is located.

The following main scenarios for entry points exist by default in the TYPO3 core:

  • Directly called documentRoot/index.php (-> FE call or eiD include): index.php is located in the same directory as the main project. The document root is identical to the directory the script is located at.
  • The install tool, located under typo3/sysext/install/Start/Install.php.
  • A Backend script: This is the case for the typo3/index.php dispatcher and other entry scripts like 'cli_dispatch.phpsh' or 'typo3/index.php' that are located inside typo3/ directly.
int$entryPointLevelNumber of subdirectories where the entry script is located under the document root
string Absolute path to document root of installation

Definition at line 372 of file SystemEnvironmentBuilder.php.

References GeneralUtility\revExplode().

static getPathThisScript ( )

Calculate PATH_thisScript

First step in path calculation: Goal is to find the absolute path of the entry script that was called without resolving any links. This is important since the TYPO3 entry points are often linked to a central core location, so we can not use the php magic FILE here, but resolve the called script path from given server environments.

This path is important to calculate the document root (PATH_site). The strategy is to find out the script name that was called in the first place and to subtract the local part from it to find the document root.

string Absolute path to entry script

Definition at line 277 of file SystemEnvironmentBuilder.php.

static getPathThisScriptCli ( )

Calculate path to entry script if in cli mode.

First argument of a cli script is the path to the script that was called. If the script does not start with / (or A:\ for Windows), the path is not absolute yet, and the current working directory is added.

string Absolute path to entry script

Definition at line 325 of file SystemEnvironmentBuilder.php.

static getPathThisScriptNonCli ( )

Calculate path to entry script if not in cli mode.

Depending on the environment, the script path is found in different $_SERVER variables.

string Absolute path to entry script

Definition at line 293 of file SystemEnvironmentBuilder.php.

static getTypo3Os ( )

Determine the operating system TYPO3 is running on.

string Either 'WIN' if running on Windows, else empty string

Definition at line 254 of file SystemEnvironmentBuilder.php.

static getUnifiedDirectoryName (   $absolutePath)

Remove file name from script path and unify for Windows and Unix

string$absolutePathAbsolute path to script
string Directory name of script file location, unified for Windows and Unix without the trailing slash

Definition at line 389 of file SystemEnvironmentBuilder.php.

static initializeBasicErrorReporting ( )

Initialize basic error reporting.

There are a lot of extensions that have no strict / notice / deprecated free ext_localconf or ext_tables. Since the final error reporting must be set up after those extension files are read, a default configuration is needed to suppress error reporting meanwhile during further bootstrap.


Definition at line 243 of file SystemEnvironmentBuilder.php.

static initializeGlobalTimeTrackingVariables ( )

Initialize global time tracking variables. These are helpers to for example output script parsetime at the end of a script.


Definition at line 216 of file SystemEnvironmentBuilder.php.

References $GLOBALS, and GeneralUtility\milliseconds().

static initializeGlobalVariables ( )

Set up / initialize several globals variables


Definition at line 201 of file SystemEnvironmentBuilder.php.

References $GLOBALS.

static isFunctionDisabled (   $function)

Check if the given function is disabled in the system


Definition at line 424 of file SystemEnvironmentBuilder.php.

References GeneralUtility\trimExplode().

static run (   $entryPointLevel = 0)

Run base setup. This entry method is used in all scopes (FE, BE, eid, ajax, ...)

Definition at line 70 of file SystemEnvironmentBuilder.php.

Referenced by Bootstrap\baseSetup().

Member Data Documentation

$disabledFunctions = null

Definition at line 60 of file SystemEnvironmentBuilder.php.

Initial value:
= [

Definition at line 47 of file SystemEnvironmentBuilder.php.