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. |
CONFIGURATION_PROCESSING_TYPE_DEFAULT |
This is the default processing, which merges configurations similar to how CONFIGURATION_PROCESSING_TYPE_SETTINGS
are merged (except that for settings an empty array is initialized for each package) |
CONFIGURATION_PROCESSING_TYPE_OBJECTS |
Appends all configurations, prefixed by the PackageKey of the configuration source |
CONFIGURATION_PROCESSING_TYPE_POLICY |
Loads and merges configurations from Packages (global Policy-configurations are not allowed) |
CONFIGURATION_PROCESSING_TYPE_ROUTES |
Loads and appends global configurations and resolves SubRoutes, creating a combined flat array of all Routes |
CONFIGURATION_PROCESSING_TYPE_SETTINGS |
Similar to CONFIGURATION_PROCESSING_TYPE_DEFAULT, but for every active package an empty array is initialized. Besides this sets "Neos.Flow.core.context" to the current context |
CONFIGURATION_PROCESSING_TYPE_APPEND |
Appends all configurations to one flat array |
Properties
protected array | $configurationTypes | Defines which Configuration Type is processed by which logic |
|
protected ApplicationContext | $context | The application context of the configuration to manage |
|
protected array | $orderedListOfContextNames | An array of context name strings, from the most generic one to the most special one. |
|
protected YamlSource | $configurationSource | ||
protected array | $configurations | Storage of the raw special configurations |
|
protected FlowPackageInterface[] | $packages | Active packages to load the configuration for |
|
protected bool | $cacheNeedsUpdate | ||
protected string | $temporaryDirectoryPath | An absolute file path to store configuration caches in. If null no cache will be active. |
|
protected array | $unprocessedConfiguration |
Methods
Set an absolute file path to store configuration caches in. If null no cache will be active.
Sets the active packages to load the configuration for
Get the available configuration-types
Resolve the processing type for the configuration type.
Check the allowSplitSource setting for the configuration type.
Registers a new configuration type with the given configuration processing type.
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.
If a cache file with previously saved configuration exists, it is removed.
Saves the current configuration into a cache file and creates a cache inclusion script in the context's Configuration directory.
No description
Replaces variables (in the format %CONSTANT% or %env:ENVIRONMENT_VARIABLE%) in the given php exported configuration string.
Merges two policy configuration arrays.
Constructs a path to the configuration cache PHP file.
Details
__construct(ApplicationContext $context)
Constructs the configuration manager
void
injectConfigurationSource(YamlSource $configurationSource)
Injects the configuration source
setTemporaryDirectoryPath(string $temporaryDirectoryPath)
Set an absolute file path to store configuration caches in. If null 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
string
resolveConfigurationProcessingType(string $configurationType)
Resolve the processing type for the configuration type.
This returns the CONFIGURATION_PROCESSINGTYPE* to use for the given $configurationType.
bool
isSplitSourceAllowedForConfigurationType(string $configurationType)
Check the allowSplitSource setting for the configuration type.
void
registerConfigurationType(string $configurationType, string $configurationProcessingType = self::CONFIGURATION_PROCESSING_TYPE_DEFAULT, bool $allowSplitSource = true)
Registers a new configuration type with the given configuration processing type.
The processing type must be supported by the ConfigurationManager, see CONFIGURATION_PROCESSINGTYPE* for what is available.
protected void
emitConfigurationManagerReady(ConfigurationManager $configurationManager)
Emits a signal after The ConfigurationManager has been loaded
array|null
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.
bool
loadConfigurationCache()
If a cache file with previously saved configuration exists, it is loaded.
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 void
saveConfigurationCache()
Saves the current configuration into a cache file and creates a cache inclusion script in the context's Configuration directory.
void
refreshConfiguration()
No description
protected mixed
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 alllow runtime evaluation of constants and environment variables.
protected array
mergePolicyConfiguration(array $firstConfigurationArray, array $secondConfigurationArray)
Merges two policy configuration arrays.
protected string
constructConfigurationCachePath()
Constructs a path to the configuration cache PHP file.
Derived from the temporary path and application context.