TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
ConfigurationManager Class Reference

Public Member Functions

 getDefaultConfiguration ()
 
 getDefaultConfigurationFileLocation ()
 
 getLocalConfiguration ()
 
 getLocalConfigurationFileLocation ()
 
 getAdditionalConfigurationFileLocation ()
 
 updateLocalConfiguration (array $configurationToMerge)
 
 getDefaultConfigurationValueByPath ($path)
 
 getLocalConfigurationValueByPath ($path)
 
 getConfigurationValueByPath ($path)
 
 setLocalConfigurationValueByPath ($path, $value)
 
 setLocalConfigurationValuesByPathValuePairs (array $pairs)
 
 removeLocalConfigurationKeysByPath (array $keys)
 
 canWriteConfiguration ()
 
 exportConfiguration ()
 
 writeLocalConfiguration (array $configuration)
 
 writeAdditionalConfiguration (array $additionalConfigurationLines)
 
 createLocalConfigurationFromFactoryConfiguration ()
 

Protected Member Functions

 getFactoryConfigurationFileLocation ()
 
 getAdditionalFactoryConfigurationFileLocation ()
 
 isValidLocalConfigurationPath ($path)
 

Protected Attributes

 $defaultConfigurationFile = 'typo3/sysext/core/Configuration/DefaultConfiguration.php'
 
 $localConfigurationFile = 'typo3conf/LocalConfiguration.php'
 
 $additionalConfigurationFile = 'typo3conf/AdditionalConfiguration.php'
 
 $factoryConfigurationFile = 'typo3/sysext/core/Configuration/FactoryConfiguration.php'
 
 $additionalFactoryConfigurationFile = 'typo3conf/AdditionalFactoryConfiguration.php'
 
 $pathTypo3Conf = PATH_typo3conf
 
 $whiteListedLocalConfigurationPaths
 

Detailed Description

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.

Definition at line 36 of file core/Classes/Configuration/ConfigurationManager.php.

Member Function Documentation

canWriteConfiguration ( )

Checks if the configuration can be written.

Returns
bool private

Definition at line 270 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\getLocalConfigurationFileLocation().

Referenced by ConfigurationManager\writeLocalConfiguration().

createLocalConfigurationFromFactoryConfiguration ( )

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.

Exceptions
RuntimeException
Returns
void private

Definition at line 362 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\getAdditionalFactoryConfigurationFileLocation(), ConfigurationManager\getFactoryConfigurationFileLocation(), ConfigurationManager\getLocalConfigurationFileLocation(), ArrayUtility\mergeRecursiveWithOverrule(), and ConfigurationManager\writeLocalConfiguration().

getAdditionalConfigurationFileLocation ( )

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

Returns
string private

Definition at line 132 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\$additionalConfigurationFile.

Referenced by ConfigurationManager\exportConfiguration().

getAdditionalFactoryConfigurationFileLocation ( )
protected

Get absolute file location of factory configuration file

Returns
string

Definition at line 152 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\$additionalFactoryConfigurationFile.

Referenced by ConfigurationManager\createLocalConfigurationFromFactoryConfiguration().

getConfigurationValueByPath (   $path)

Get a value from configuration, this is default configuration merged with local configuration

Parameters
string$pathPath to search for
Returns
mixed

Definition at line 199 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\getDefaultConfiguration(), ConfigurationManager\getLocalConfiguration(), ArrayUtility\getValueByPath(), and ArrayUtility\mergeRecursiveWithOverrule().

getDefaultConfigurationFileLocation ( )

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

Returns
string private

Definition at line 98 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\$defaultConfigurationFile.

Referenced by ConfigurationManager\getDefaultConfiguration().

getDefaultConfigurationValueByPath (   $path)

Get a value at given path from default configuration

Parameters
string$pathPath to search for
Returns
mixed Value at path

Definition at line 176 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\getDefaultConfiguration(), and ArrayUtility\getValueByPath().

getFactoryConfigurationFileLocation ( )
protected

Get absolute file location of factory configuration file

Returns
string

Definition at line 142 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\$factoryConfigurationFile.

Referenced by ConfigurationManager\createLocalConfigurationFromFactoryConfiguration().

getLocalConfigurationValueByPath (   $path)

Get a value at given path from local configuration

Parameters
string$pathPath to search for
Returns
mixed Value at path

Definition at line 187 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\getLocalConfiguration(), and ArrayUtility\getValueByPath().

isValidLocalConfigurationPath (   $path)
protected

Check if access / write to given path in local configuration is allowed.

Parameters
string$pathPath to search for
Returns
bool TRUE if access is allowed

Definition at line 388 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\getDefaultConfiguration(), GeneralUtility\isFirstPartOfStr(), and ArrayUtility\isValidPath().

Referenced by ConfigurationManager\setLocalConfigurationValueByPath(), and ConfigurationManager\setLocalConfigurationValuesByPathValuePairs().

removeLocalConfigurationKeysByPath ( array  $keys)

Remove keys from LocalConfiguration

Parameters
array$keysArray with key paths to remove from LocalConfiguration
Returns
bool TRUE if something was removed

Definition at line 247 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\getLocalConfiguration(), ArrayUtility\isValidPath(), ArrayUtility\removeByPath(), and ConfigurationManager\writeLocalConfiguration().

setLocalConfigurationValueByPath (   $path,
  $value 
)

Update a given path in local configuration to a new value.

Parameters
string$pathPath to update
mixed$valueValue to set
Returns
bool TRUE on success

Definition at line 213 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\getLocalConfiguration(), ConfigurationManager\isValidLocalConfigurationPath(), ArrayUtility\setValueByPath(), and ConfigurationManager\writeLocalConfiguration().

setLocalConfigurationValuesByPathValuePairs ( array  $pairs)

Update / set a list of path and value pairs in local configuration file

Parameters
array$pairsKey is path, value is value to set
Returns
bool TRUE on success

Definition at line 230 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\getLocalConfiguration(), ConfigurationManager\isValidLocalConfigurationPath(), ArrayUtility\setValueByPath(), and ConfigurationManager\writeLocalConfiguration().

updateLocalConfiguration ( array  $configurationToMerge)

Override local configuration with new values.

Parameters
array$configurationToMergeOverride configuration array
Returns
void

Definition at line 163 of file core/Classes/Configuration/ConfigurationManager.php.

References ConfigurationManager\getLocalConfiguration(), ArrayUtility\mergeRecursiveWithOverrule(), and ConfigurationManager\writeLocalConfiguration().

writeAdditionalConfiguration ( array  $additionalConfigurationLines)

Write additional configuration array to typo3conf/AdditionalConfiguration.php

Parameters
array$additionalConfigurationLinesThe configuration lines to be written
Exceptions
RuntimeException
Returns
bool TRUE on success private

Definition at line 344 of file core/Classes/Configuration/ConfigurationManager.php.

References GeneralUtility\writeFile().

Member Data Documentation

$additionalConfigurationFile = 'typo3conf/AdditionalConfiguration.php'
protected
$additionalFactoryConfigurationFile = 'typo3conf/AdditionalFactoryConfiguration.php'
protected
$defaultConfigurationFile = 'typo3/sysext/core/Configuration/DefaultConfiguration.php'
protected
$factoryConfigurationFile = 'typo3/sysext/core/Configuration/FactoryConfiguration.php'
protected
$localConfigurationFile = 'typo3conf/LocalConfiguration.php'
protected
$pathTypo3Conf = PATH_typo3conf
protected
$whiteListedLocalConfigurationPaths
protected
Initial value:
= [
'EXT/extConf',
'EXTCONF',
'DB',
'SYS/caching/cacheConfigurations',
]

Definition at line 74 of file core/Classes/Configuration/ConfigurationManager.php.