TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Core\SystemEnvironmentBuilder Class Reference

Static Public Member Functions

static run ($relativePathPart='')
 
static isFunctionDisabled ($function)
 

Static Protected Member Functions

static defineBaseConstants ()
 
static definePaths ($relativePathPart='')
 
static checkMainPathsExist ()
 
static initializeGlobalVariables ()
 
static initializeGlobalTimeTrackingVariables ()
 
static initializeBasicErrorReporting ()
 
static getTypo3Os ()
 
static getPathThisScript ()
 
static getPathThisScriptNonCli ()
 
static getPathThisScriptCli ()
 
static getPathSite ($relativePathPart)
 
static getUnifiedDirectoryNameWithTrailingSlash ($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

◆ checkMainPathsExist()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::checkMainPathsExist ( )
staticprotected

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

Returns
void

Definition at line 182 of file SystemEnvironmentBuilder.php.

◆ defineBaseConstants()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::defineBaseConstants ( )
staticprotected

Define all simple constants that have no dependency to local configuration

Returns
void

Definition at line 85 of file SystemEnvironmentBuilder.php.

◆ definePaths()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::definePaths (   $relativePathPart = '')
staticprotected

Calculate all required base paths and set as constants.

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

Definition at line 152 of file SystemEnvironmentBuilder.php.

◆ exitWithMessage()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::exitWithMessage (   $message)
staticprotected

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

Parameters
string$message

Definition at line 403 of file SystemEnvironmentBuilder.php.

References TYPO3\CMS\Core\Utility\HttpUtility\HTTP_STATUS_500.

◆ getPathSite()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::getPathSite (   $relativePathPart)
staticprotected

Calculate the document root part to the instance from PATH_thisScript

We have two main scenarios for entry points:

  • Directly called documentRoot/index.php (-> FE call or eiD include): index.php sets $relativePathPart to empty string to hint this code that the document root is identical to the directory the script is located at.
  • An indirect include of any Backend related script (-> typo3/index.php or the install tool).
  • A Backend script: This is the case for the index.php dispatcher and other entry scripts like 'cli_dispatch.phpsh' or 'typo3/index.php' that are located inside typo3/ directly. In this case the Bootstrap->run() command sets 'typo3/' as $relativePathPart as base to calculate the document root.
Parameters
string$relativePathPartRelative directory part from document root to script path
Returns
string Absolute path to document root of installation

Definition at line 372 of file SystemEnvironmentBuilder.php.

◆ getPathThisScript()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::getPathThisScript ( )
staticprotected

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.

Returns
string Absolute path to entry script

Definition at line 277 of file SystemEnvironmentBuilder.php.

◆ getPathThisScriptCli()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::getPathThisScriptCli ( )
staticprotected

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.

Returns
string Absolute path to entry script

Definition at line 325 of file SystemEnvironmentBuilder.php.

◆ getPathThisScriptNonCli()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::getPathThisScriptNonCli ( )
staticprotected

Calculate path to entry script if not in cli mode.

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

Returns
string Absolute path to entry script

Definition at line 293 of file SystemEnvironmentBuilder.php.

◆ getTypo3Os()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::getTypo3Os ( )
staticprotected

Determine the operating system TYPO3 is running on.

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

Definition at line 254 of file SystemEnvironmentBuilder.php.

◆ getUnifiedDirectoryNameWithTrailingSlash()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::getUnifiedDirectoryNameWithTrailingSlash (   $absolutePath)
staticprotected

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

Parameters
string$absolutePathAbsolute path to script
Returns
string Directory name of script file location, unified for Windows and Unix

Definition at line 389 of file SystemEnvironmentBuilder.php.

◆ initializeBasicErrorReporting()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::initializeBasicErrorReporting ( )
staticprotected

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.

Returns
void

Definition at line 243 of file SystemEnvironmentBuilder.php.

◆ initializeGlobalTimeTrackingVariables()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::initializeGlobalTimeTrackingVariables ( )
staticprotected

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

Returns
void

Definition at line 216 of file SystemEnvironmentBuilder.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\GeneralUtility\milliseconds().

◆ initializeGlobalVariables()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::initializeGlobalVariables ( )
staticprotected

Set up / initialize several globals variables

Returns
void

Definition at line 201 of file SystemEnvironmentBuilder.php.

References $GLOBALS.

◆ isFunctionDisabled()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::isFunctionDisabled (   $function)
static

Check if the given function is disabled in the system

Parameters
string$function
Returns
bool

Definition at line 424 of file SystemEnvironmentBuilder.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

◆ run()

static TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run (   $relativePathPart = '')
static

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 TYPO3\CMS\Core\Core\Bootstrap\baseSetup().

Member Data Documentation

◆ $disabledFunctions

TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::$disabledFunctions = null
staticprotected

Definition at line 60 of file SystemEnvironmentBuilder.php.

◆ $supportedCgiServerApis

TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::$supportedCgiServerApis
staticprotected
Initial value:
= [
'fpm-fcgi',
'cgi',
'isapi',
'cgi-fcgi',
'srv',
]

Definition at line 47 of file SystemEnvironmentBuilder.php.