Skip to content

Commit

Permalink
Merge pull request #1317 from chillu/pulls/config.php-after-statics
Browse files Browse the repository at this point in the history
FIX Load _config.php's after static config manifest
  • Loading branch information
Hamish Friedlander committed Mar 20, 2013
2 parents 63c8441 + 81a5133 commit c6eb192
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
7 changes: 1 addition & 6 deletions core/manifest/ClassLoader.php
Expand Up @@ -43,19 +43,14 @@ public function hasManifest() {
}

/**
* Pushes a class manifest instance onto the top of the stack. This will
* also include any module configuration files at the same time.
* Pushes a class manifest instance onto the top of the stack.
*
* @param SS_ClassManifest $manifest
* @param Boolean Marks the manifest as exclusive. If set to FALSE, will
* look for classes in earlier manifests as well.
*/
public function pushManifest(SS_ClassManifest $manifest, $exclusive = true) {
$this->manifests[] = array('exclusive' => $exclusive, 'instance' => $manifest);

foreach ($manifest->getConfigs() as $config) {
require_once $config;
}
}

/**
Expand Down
8 changes: 5 additions & 3 deletions docs/en/changelogs/3.1.0.md
Expand Up @@ -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
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
configuration system will silently ignore it.

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
["Configuration" topic](/topic/configuration).
`$this->config()->update()`. This mostly applies to changes in `_config.php`, which is
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

Expand Down
9 changes: 5 additions & 4 deletions docs/en/topics/configuration.md
Expand Up @@ -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

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

Expand Down Expand Up @@ -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:

- 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)

- Any static set on an "additional static source" class (such as an extension) named the same as the name of the property
Expand Down

0 comments on commit c6eb192

Please sign in to comment.