Merge pull request #1317 from chillu/pulls/config.php-after-statics

FIX Load _config.php's after static config manifest
This commit is contained in:
Hamish Friedlander 2013-03-20 16:23:35 -07:00
commit c6eb1924ca
3 changed files with 11 additions and 13 deletions

View File

@ -43,8 +43,7 @@ class SS_ClassLoader {
} }
/** /**
* Pushes a class manifest instance onto the top of the stack. This will * Pushes a class manifest instance onto the top of the stack.
* also include any module configuration files at the same time.
* *
* @param SS_ClassManifest $manifest * @param SS_ClassManifest $manifest
* @param Boolean Marks the manifest as exclusive. If set to FALSE, will * @param Boolean Marks the manifest as exclusive. If set to FALSE, will
@ -52,10 +51,6 @@ class SS_ClassLoader {
*/ */
public function pushManifest(SS_ClassManifest $manifest, $exclusive = true) { public function pushManifest(SS_ClassManifest $manifest, $exclusive = true) {
$this->manifests[] = array('exclusive' => $exclusive, 'instance' => $manifest); $this->manifests[] = array('exclusive' => $exclusive, 'instance' => $manifest);
foreach ($manifest->getConfigs() as $config) {
require_once $config;
}
} }
/** /**

View File

@ -42,13 +42,15 @@ of defining the default value.
In SilverStripe 3.0, it was possible to edit this value at run-time and have the change propagate into the In SilverStripe 3.0, it was possible to edit this value at run-time and have the change propagate into the
configuration system. This is no longer the case, for performance reasons. configuration system. This is no longer the case, for performance reasons.
Many of the configuration variables have been change to "private" so that attempts to change them throw an Many of the configuration variables have been changed to "private" so that attempts to change them throw an
error, but if you do have a configuration static that is able to be changed, and you change it, then the error, but if you do have a configuration static that is able to be changed, and you change it, then the
configuration system will silently ignore it. configuration system will silently ignore it.
Please change all run-time manipulation of configuration to use `Config::inst()->update()` or Please change all run-time manipulation of configuration to use `Config::inst()->update()` or
`$this->config()->update()`. For more information about how to use the config system, see the `$this->config()->update()`. This mostly applies to changes in `_config.php`, which is
["Configuration" topic](/topic/configuration). processed after the YAML and PHP statics configuration are compiled.
For more information about how to use the config system, see the ["Configuration" topic](/topic/configuration).
### default_cast is now Text ### default_cast is now Text

View File

@ -14,9 +14,10 @@ SilverStripe system due to three properties:
- Configuration is normally set by a knowledgeable technical user, such as a developer, not the end user - Configuration is normally set by a knowledgeable technical user, such as a developer, not the end user
In SilverStripe 3, each class has it's configuration specified as set of named properties and associated values. The In SilverStripe 3, each class has it's configuration specified as set of named properties and associated values. The
values at any given time are calculated by merging several sources using rules explained below. These sources are: values at any given time are calculated by merging several sources using rules explained below.
These sources are as follows (in highest -> lowest priority order):
- Values set via a call to Config#update - Values set via a call to Config#update (e.g. in `_config.php`)
- Values taken from YAML files in specially named directories - Values taken from YAML files in specially named directories
@ -69,9 +70,9 @@ the result will be the higher priority false-ish value.
The locations that configuration values are taken from in highest -> lowest priority order are: The locations that configuration values are taken from in highest -> lowest priority order are:
- Any values set via a call to Config#update - Any values set via a call to Config#update (e.g. via `_config.php`)
- The configuration values taken from the YAML files in _config directories (internally sorted in before / after order, where - The configuration values taken from the YAML files in `_config/` directories (internally sorted in before / after order, where
the item that is latest is highest priority) the item that is latest is highest priority)
- Any static set on an "additional static source" class (such as an extension) named the same as the name of the property - Any static set on an "additional static source" class (such as an extension) named the same as the name of the property