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)
  • config/system/settings.php or typo3conf/system/settings.php - previously known as LocalConfiguration.php
  • config/system/additional.php or typo3conf/system/additional.php (optional additional code blocks) - previously known as typo3conf/AdditionalConfiguration.php

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 the config/system/settings.php file with an extension.

Internal

Table of Contents

Properties

$additionalFactoryConfigurationFile  : string
$allowedSettingsPaths  : array<string|int, mixed>
Writing to these configuration paths is always allowed, even if the requested sub path does not exist yet.
$defaultConfigurationDescriptionFile  : string
$defaultConfigurationFile  : string
$factoryConfigurationFile  : string

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 config/system/settings.php. This is used by the installer in an early step.
disableFeature()  : bool
Disables a feature and writes the option to system/settings.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 system/settings.php Short-hand method Warning: TO BE USED ONLY to enable a single feature.
exportConfiguration()  : void
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 configuration array of typo3conf/system/settings.php or config/system/settings.php, falls back to 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
getSystemConfigurationFileLocation()  : string
Get the file location of the TYPO3-project specific settings file, currently the path and filename.
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 config/system/additional.php / typo3conf/system/additional.php
writeLocalConfiguration()  : bool
Write configuration array to %config-dir%/system/settings.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

$additionalFactoryConfigurationFile

protected string $additionalFactoryConfigurationFile = 'AdditionalFactoryConfiguration.php'

Path to possible additional factory configuration file delivered by packages

$allowedSettingsPaths

Writing to these configuration paths is always allowed, even if the requested sub path does not exist yet.

protected array<string|int, mixed> $allowedSettingsPaths = ['EXTCONF', 'DB', 'SYS/caching/cacheConfigurations', 'SYS/encryptionKey', 'SYS/session', 'EXTENSIONS']

$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

Methods

canWriteConfiguration()

Checks if the configuration can be written.

public canWriteConfiguration() : bool
Internal
Return values
bool

createLocalConfigurationFromFactoryConfiguration()

Uses FactoryConfiguration file and a possible AdditionalFactoryConfiguration file in typo3conf to create a basic config/system/settings.php. This is used by the installer in an early step.

public createLocalConfigurationFromFactoryConfiguration() : mixed
Internal
Tags
throws
RuntimeException

disableFeature()

Disables a feature and writes the option to system/settings.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 system/settings.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() : void
Internal
Tags
throws
UnexpectedValueException

getAdditionalConfigurationFileLocation()

Get the file location of the additional configuration file, currently the path and filename.

public getAdditionalConfigurationFileLocation() : string
Internal
Return values
string

getConfigurationValueByPath()

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
Internal
Return values
string

getDefaultConfigurationFileLocation()

Get the file location of the default configuration file, currently the path and filename.

public getDefaultConfigurationFileLocation() : string
Internal
Return values
string

getDefaultConfigurationValueByPath()

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 configuration array of typo3conf/system/settings.php or config/system/settings.php, falls back to 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

Path to local overload TYPO3_CONF_VARS file.

Internal
Return values
string

getLocalConfigurationValueByPath()

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>

getSystemConfigurationFileLocation()

Get the file location of the TYPO3-project specific settings file, currently the path and filename.

public getSystemConfigurationFileLocation([bool $relativeToProjectRoot = false ]) : string

Path to local overload TYPO3_CONF_VARS file.

Parameters
$relativeToProjectRoot : bool = false
Internal
Return values
string

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 config/system/additional.php / typo3conf/system/additional.php

public writeAdditionalConfiguration(array<string|int, mixed> $additionalConfigurationLines) : bool
Parameters
$additionalConfigurationLines : array<string|int, mixed>

The configuration lines to be written

Internal
Tags
throws
RuntimeException
Return values
bool

TRUE on success

writeLocalConfiguration()

Write configuration array to %config-dir%/system/settings.php

public writeLocalConfiguration(array<string|int, mixed> $configuration) : bool
Parameters
$configuration : array<string|int, mixed>

The local configuration to be written

Internal
Tags
throws
RuntimeException
Return values
bool

TRUE on success

getAdditionalFactoryConfigurationFileLocation()

Get absolute file location of factory configuration file

protected getAdditionalFactoryConfigurationFileLocation() : string
Return values
string

getFactoryConfigurationFileLocation()

Get absolute file location of factory configuration file

protected getFactoryConfigurationFileLocation() : string
Return values
string

isValidLocalConfigurationPath()

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


        
On this page

Search results