ConfigurationManager
Handle loading and writing of global and local (instance specific) configuration.
This class handles the access to the files
- EXT:core/Configuration/DefaultConfiguration.php (default TYPO3_CONF_VARS)
- typo3conf/LocalConfiguration.php (overrides of TYPO3_CONF_VARS)
- typo3conf/AdditionalConfiguration.php (optional additional local code blocks)
IMPORTANT: This class is intended for internal core use ONLY. Extensions should usually use the resulting $GLOBALS['TYPO3_CONF_VARS'] array, do not try to modify settings in LocalConfiguration.php with an extension.
Table of Contents
Properties
- $additionalConfigurationFile : string
- $additionalFactoryConfigurationFile : string
- $defaultConfigurationDescriptionFile : string
- $defaultConfigurationFile : string
- $factoryConfigurationFile : string
- $localConfigurationFile : string
- $whiteListedLocalConfigurationPaths : array<string|int, mixed>
- Writing to these configuration paths is always allowed, even if the requested sub path does not exist yet.
Methods
- canWriteConfiguration() : bool
- Checks if the configuration can be written.
- createLocalConfigurationFromFactoryConfiguration() : mixed
- Uses FactoryConfiguration file and a possible AdditionalFactoryConfiguration file in typo3conf to create a basic LocalConfiguration.php. This is used by the install tool in an early step.
- disableFeature() : bool
- Disables a feature and writes the option to LocalConfiguration.php Short-hand method Warning: TO BE USED ONLY to disable a single feature.
- enableFeature() : bool
- Enables a certain feature and writes the option to LocalConfiguration.php Short-hand method Warning: TO BE USED ONLY to enable a single feature.
- exportConfiguration() : mixed
- Reads the configuration array and exports it to the global variable
- getAdditionalConfigurationFileLocation() : string
- Get the file location of the additional configuration file, currently the path and filename.
- getConfigurationValueByPath() : mixed
- Get a value from configuration, this is default configuration merged with local configuration
- getDefaultConfiguration() : array<string|int, mixed>
- Return default configuration array
- getDefaultConfigurationDescriptionFileLocation() : string
- Get the file location of the default configuration description file, currently the path and filename.
- getDefaultConfigurationFileLocation() : string
- Get the file location of the default configuration file, currently the path and filename.
- getDefaultConfigurationValueByPath() : mixed
- Get a value at given path from default configuration
- getLocalConfiguration() : array<string|int, mixed>
- Return local configuration array typo3conf/LocalConfiguration.php
- getLocalConfigurationFileLocation() : string
- Get the file location of the local configuration file, currently the path and filename.
- getLocalConfigurationValueByPath() : mixed
- Get a value at given path from local configuration
- getMergedLocalConfiguration() : array<string|int, mixed>
- Returns local configuration array merged with default configuration
- removeLocalConfigurationKeysByPath() : bool
- Remove keys from LocalConfiguration
- setLocalConfigurationValueByPath() : bool
- Update a given path in local configuration to a new value.
- setLocalConfigurationValuesByPathValuePairs() : bool
- Update / set a list of path and value pairs in local configuration file
- updateLocalConfiguration() : mixed
- Override local configuration with new values.
- writeAdditionalConfiguration() : bool
- Write additional configuration array to typo3conf/AdditionalConfiguration.php
- writeLocalConfiguration() : bool
- Write local configuration array to typo3conf/LocalConfiguration.php
- getAdditionalFactoryConfigurationFileLocation() : string
- Get absolute file location of factory configuration file
- getFactoryConfigurationFileLocation() : string
- Get absolute file location of factory configuration file
- isValidLocalConfigurationPath() : bool
- Check if access / write to given path in local configuration is allowed.
Properties
$additionalConfigurationFile
protected
string
$additionalConfigurationFile
= 'AdditionalConfiguration.php'
Path to additional local file, relative to the public web folder
$additionalFactoryConfigurationFile
protected
string
$additionalFactoryConfigurationFile
= 'AdditionalFactoryConfiguration.php'
Path to possible additional factory configuration file delivered by packages
$defaultConfigurationDescriptionFile
protected
string
$defaultConfigurationDescriptionFile
= 'EXT:core/Configuration/DefaultConfigurationDescription.yaml'
Path to description file for TYPO3_CONF_VARS, relative to the public web folder
$defaultConfigurationFile
protected
string
$defaultConfigurationFile
= __DIR__ . '/../../Configuration/DefaultConfiguration.php'
Path to default TYPO3_CONF_VARS file, relative to the public web folder
$factoryConfigurationFile
protected
string
$factoryConfigurationFile
= __DIR__ . '/../../Configuration/FactoryConfiguration.php'
Path to factory configuration file used during installation as LocalConfiguration boilerplate
$localConfigurationFile
protected
string
$localConfigurationFile
= 'LocalConfiguration.php'
Path to local overload TYPO3_CONF_VARS file, relative to the public web folder
$whiteListedLocalConfigurationPaths
Writing to these configuration paths is always allowed, even if the requested sub path does not exist yet.
protected
array<string|int, mixed>
$whiteListedLocalConfigurationPaths
= ['EXTCONF', 'DB', 'SYS/caching/cacheConfigurations', 'SYS/encryptionKey', 'SYS/session', 'EXTENSIONS']
Methods
canWriteConfiguration()
Checks if the configuration can be written.
public
canWriteConfiguration() : bool
Return values
boolcreateLocalConfigurationFromFactoryConfiguration()
Uses FactoryConfiguration file and a possible AdditionalFactoryConfiguration file in typo3conf to create a basic LocalConfiguration.php. This is used by the install tool in an early step.
public
createLocalConfigurationFromFactoryConfiguration() : mixed
Tags
disableFeature()
Disables a feature and writes the option to LocalConfiguration.php Short-hand method Warning: TO BE USED ONLY to disable a single feature.
public
disableFeature(string $featureName) : bool
NOT TO BE USED within iterations to disable multiple features. To update multiple features use setLocalConfigurationValuesByPathValuePairs().
Parameters
- $featureName : string
-
something like "InlineSvgImages"
Return values
bool —true on successful writing the setting
enableFeature()
Enables a certain feature and writes the option to LocalConfiguration.php Short-hand method Warning: TO BE USED ONLY to enable a single feature.
public
enableFeature(string $featureName) : bool
NOT TO BE USED within iterations to enable multiple features. To update multiple features use setLocalConfigurationValuesByPathValuePairs().
Parameters
- $featureName : string
-
something like "InlineSvgImages"
Return values
bool —true on successful writing the setting
exportConfiguration()
Reads the configuration array and exports it to the global variable
public
exportConfiguration() : mixed
Tags
getAdditionalConfigurationFileLocation()
Get the file location of the additional configuration file, currently the path and filename.
public
getAdditionalConfigurationFileLocation() : string
Return values
stringgetConfigurationValueByPath()
Get a value from configuration, this is default configuration merged with local configuration
public
getConfigurationValueByPath(string $path) : mixed
Parameters
- $path : string
-
Path to search for
getDefaultConfiguration()
Return default configuration array
public
getDefaultConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed>getDefaultConfigurationDescriptionFileLocation()
Get the file location of the default configuration description file, currently the path and filename.
public
getDefaultConfigurationDescriptionFileLocation() : string
Return values
stringgetDefaultConfigurationFileLocation()
Get the file location of the default configuration file, currently the path and filename.
public
getDefaultConfigurationFileLocation() : string
Return values
stringgetDefaultConfigurationValueByPath()
Get a value at given path from default configuration
public
getDefaultConfigurationValueByPath(string $path) : mixed
Parameters
- $path : string
-
Path to search for
Return values
mixed —Value at path
getLocalConfiguration()
Return local configuration array typo3conf/LocalConfiguration.php
public
getLocalConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed> —Content array of local configuration file
getLocalConfigurationFileLocation()
Get the file location of the local configuration file, currently the path and filename.
public
getLocalConfigurationFileLocation() : string
Return values
stringgetLocalConfigurationValueByPath()
Get a value at given path from local configuration
public
getLocalConfigurationValueByPath(string $path) : mixed
Parameters
- $path : string
-
Path to search for
Return values
mixed —Value at path
getMergedLocalConfiguration()
Returns local configuration array merged with default configuration
public
getMergedLocalConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed>removeLocalConfigurationKeysByPath()
Remove keys from LocalConfiguration
public
removeLocalConfigurationKeysByPath(array<string|int, mixed> $keys) : bool
Parameters
- $keys : array<string|int, mixed>
-
Array with key paths to remove from LocalConfiguration
Return values
bool —TRUE if something was removed
setLocalConfigurationValueByPath()
Update a given path in local configuration to a new value.
public
setLocalConfigurationValueByPath(string $path, mixed $value) : bool
Warning: TO BE USED ONLY to update a single feature. NOT TO BE USED within iterations to update multiple features. To update multiple features use setLocalConfigurationValuesByPathValuePairs().
Parameters
- $path : string
-
Path to update
- $value : mixed
-
Value to set
Return values
bool —TRUE on success
setLocalConfigurationValuesByPathValuePairs()
Update / set a list of path and value pairs in local configuration file
public
setLocalConfigurationValuesByPathValuePairs(array<string|int, mixed> $pairs) : bool
Parameters
- $pairs : array<string|int, mixed>
-
Key is path, value is value to set
Return values
bool —TRUE on success
updateLocalConfiguration()
Override local configuration with new values.
public
updateLocalConfiguration(array<string|int, mixed> $configurationToMerge) : mixed
Parameters
- $configurationToMerge : array<string|int, mixed>
-
Override configuration array
writeAdditionalConfiguration()
Write additional configuration array to typo3conf/AdditionalConfiguration.php
public
writeAdditionalConfiguration(array<string|int, mixed> $additionalConfigurationLines) : bool
Parameters
- $additionalConfigurationLines : array<string|int, mixed>
-
The configuration lines to be written
Tags
Return values
bool —TRUE on success
writeLocalConfiguration()
Write local configuration array to typo3conf/LocalConfiguration.php
public
writeLocalConfiguration(array<string|int, mixed> $configuration) : bool
Parameters
- $configuration : array<string|int, mixed>
-
The local configuration to be written
Tags
Return values
bool —TRUE on success
getAdditionalFactoryConfigurationFileLocation()
Get absolute file location of factory configuration file
protected
getAdditionalFactoryConfigurationFileLocation() : string
Return values
stringgetFactoryConfigurationFileLocation()
Get absolute file location of factory configuration file
protected
getFactoryConfigurationFileLocation() : string
Return values
stringisValidLocalConfigurationPath()
Check if access / write to given path in local configuration is allowed.
protected
isValidLocalConfigurationPath(string $path) : bool
Parameters
- $path : string
-
Path to search for
Return values
bool —TRUE if access is allowed