ConfigurationManager
class ConfigurationManager (View source)
A general purpose configuration manager
Constants
CONFIGURATION_TYPE_CACHES |
Contains a list of caches which are registered automatically. Caches defined in this configuration file are
registered in an early stage of the boot process and profit from mechanisms such as automatic flushing by the
File Monitor. See the chapter about the Cache Framework for details. |
CONFIGURATION_TYPE_OBJECTS |
Contains object configuration, i.e. options which configure objects and the combination of those on a lower
level. See the Object Framework chapter for more information. |
CONFIGURATION_TYPE_ROUTES |
Contains routes configuration. This routing information is parsed and used by the MVC Web Routing mechanism. Refer to the Routing chapter for more information. |
CONFIGURATION_TYPE_POLICY |
Contains the configuration of the security policies of the system. See the Security chapter for details. |
CONFIGURATION_TYPE_SETTINGS |
Contains user-level settings, i.e. configuration options the users or administrators are meant to change. Settings are the highest level of system configuration. |
deprecated CONFIGURATION_PROCESSING_TYPE_DEFAULT |
|
deprecated CONFIGURATION_PROCESSING_TYPE_OBJECTS |
|
deprecated CONFIGURATION_PROCESSING_TYPE_POLICY |
|
deprecated CONFIGURATION_PROCESSING_TYPE_ROUTES |
|
deprecated CONFIGURATION_PROCESSING_TYPE_SETTINGS |
|
deprecated CONFIGURATION_PROCESSING_TYPE_APPEND |
|
Properties
protected LoaderInterface[] | $configurationLoaders | Defines which Configuration Type is processed by which logic |
|
protected ApplicationContext | $context | The application context of the configuration to manage |
|
protected array | $configurations | Storage of the raw special configurations |
|
protected FlowPackageInterface[] | $packages | Active packages to load the configuration for |
|
protected bool | $cacheNeedsUpdate | ||
protected string|null | $temporaryDirectoryPath | An absolute file path to store configuration caches in. If not set, no cache will be active. |
|
protected array | $unprocessedConfiguration |
Methods
Set an absolute file path to store configuration caches in.
Sets the active packages to load the configuration for
Get the available configuration-types
Registers a new configuration type with the given source.
Emits a signal after The ConfigurationManager has been loaded
Returns the specified raw configuration.
Shuts down the configuration manager.
Warms up the complete configuration cache, i.e. fetching every configured configuration type in order to be able to store it into the cache, if configured to do so.
Loads special configuration defined in the specified packages and merges them with those potentially existing in the global configuration folders. The result is stored in the configuration manager's configuration registry and can be retrieved with the getConfiguration() method.
If a cache file with previously saved configuration exists, it is loaded.
Includes the cached configuration file such that $this->configurations is fully populated
If a cache file with previously saved configuration exists, it is removed.
Generate configuration with environment variables replaced without modifying or loading the cache
Saves the current configuration into a cache file and creates a cache inclusion script in the context's Configuration directory.
Writes the cache on disk in the given cache file
No description
Replaces variables (in the format %CONSTANT% or %env:ENVIRONMENT_VARIABLE%) in the given php exported configuration string.
Constructs a path to the configuration cache PHP file.
Details
__construct(ApplicationContext $context)
Constructs the configuration manager
void
setTemporaryDirectoryPath(string $temporaryDirectoryPath)
Set an absolute file path to store configuration caches in.
If never called no cache will be active.
void
setPackages(array $packages)
Sets the active packages to load the configuration for
array
getAvailableConfigurationTypes()
Get the available configuration-types
void
registerConfigurationType(string $configurationType, LoaderInterface|string|null $configurationLoader = null)
Registers a new configuration type with the given source.
protected void
emitConfigurationManagerReady(ConfigurationManager $configurationManager)
Emits a signal after The ConfigurationManager has been loaded
mixed
getConfiguration(string $configurationType, string $configurationPath = null)
Returns the specified raw configuration.
The actual configuration will be merged from different sources in a defined order.
Note that this is a low level method and mostly makes sense to be used by Flow internally. If possible just use settings and have them injected.
void
shutdown()
Shuts down the configuration manager.
This method writes the current configuration into a cache file if Flow was configured to do so.
void
warmup()
Warms up the complete configuration cache, i.e. fetching every configured configuration type in order to be able to store it into the cache, if configured to do so.
protected void
loadConfiguration(string $configurationType, array $packages)
Loads special configuration defined in the specified packages and merges them with those potentially existing in the global configuration folders. The result is stored in the configuration manager's configuration registry and can be retrieved with the getConfiguration() method.
protected void
replaceConfigurationForConfigurationType(string $configurationType, string $cachePathAndFilename)
If a cache file with previously saved configuration exists, it is loaded.
protected void
loadConfigurationsFromCache()
Includes the cached configuration file such that $this->configurations is fully populated
void
flushConfigurationCache()
If a cache file with previously saved configuration exists, it is removed.
Internal: After this the configuration manager is left without any configuration, use refreshConfiguration if you want to reread the configuration.
protected
processConfigurationType(string $configurationType)
Generate configuration with environment variables replaced without modifying or loading the cache
protected void
saveConfigurationCache()
Saves the current configuration into a cache file and creates a cache inclusion script in the context's Configuration directory.
protected void
writeConfigurationCacheFile(string $cachePathAndFilename, string $configurationType = null)
Writes the cache on disk in the given cache file
void
refreshConfiguration()
No description
protected string
replaceVariablesInPhpString(string $phpString)
Replaces variables (in the format %CONSTANT% or %env:ENVIRONMENT_VARIABLE%) in the given php exported configuration string.
This is applied before caching to allow runtime evaluation of constants and environment variables.
protected string
constructConfigurationCachePath()
Constructs a path to the configuration cache PHP file.
Derived from the temporary path and application context.