mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR ConfigManifest cache fixes
- Do not skip the cache if there are currently no environmental specific spec, just use the an empty variantKeySpec. - When doing a regeneration of the config, clear the previous values from the array before regeneration.
This commit is contained in:
parent
ebe75fefab
commit
5e79e81b31
@ -59,9 +59,8 @@ class SS_ConfigManifest {
|
|||||||
if (!$forceRegen) {
|
if (!$forceRegen) {
|
||||||
// The PHP config sources are always needed
|
// The PHP config sources are always needed
|
||||||
$this->phpConfigSources = $this->cache->load('php_config_sources');
|
$this->phpConfigSources = $this->cache->load('php_config_sources');
|
||||||
|
// Get the variant key spec
|
||||||
// Get the variant key spec - if this isn't present, we can't figure out what variant we're in so it's full regen time
|
$this->variantKeySpec = $this->cache->load('variant_key_spec');
|
||||||
if ($this->variantKeySpec = $this->cache->load('variant_key_spec')) {
|
|
||||||
// Try getting the pre-filtered & merged config for this variant
|
// Try getting the pre-filtered & merged config for this variant
|
||||||
if (!($this->yamlConfig = $this->cache->load('yaml_config_'.$this->variantKey()))) {
|
if (!($this->yamlConfig = $this->cache->load('yaml_config_'.$this->variantKey()))) {
|
||||||
// Otherwise, if we do have the yaml config fragments (and we should since we have a variant key spec) work out the config for this variant
|
// Otherwise, if we do have the yaml config fragments (and we should since we have a variant key spec) work out the config for this variant
|
||||||
@ -70,7 +69,6 @@ class SS_ConfigManifest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// If we don't have a config yet, we need to do a full regen to get it
|
// If we don't have a config yet, we need to do a full regen to get it
|
||||||
if (!$this->yamlConfig) {
|
if (!$this->yamlConfig) {
|
||||||
@ -122,6 +120,10 @@ class SS_ConfigManifest {
|
|||||||
* @param bool $cache Cache the result.
|
* @param bool $cache Cache the result.
|
||||||
*/
|
*/
|
||||||
public function regenerate($includeTests = false, $cache = true) {
|
public function regenerate($includeTests = false, $cache = true) {
|
||||||
|
$this->phpConfigSources = array();
|
||||||
|
$this->yamlConfigFragments = array();
|
||||||
|
$this->variantKeySpec = array();
|
||||||
|
|
||||||
$finder = new ManifestFileFinder();
|
$finder = new ManifestFileFinder();
|
||||||
$finder->setOptions(array(
|
$finder->setOptions(array(
|
||||||
'name_regex' => '/_config.php$/',
|
'name_regex' => '/_config.php$/',
|
||||||
|
Loading…
Reference in New Issue
Block a user