Skip to content
This repository
Browse code

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.
  • Loading branch information...
commit 5e79e81b31d75defc1ebe014dd5efa3f6928d929 1 parent ebe75fe
Stig Lindqvist authored April 07, 2012 chillu committed April 15, 2012

Showing 1 changed file with 11 additions and 9 deletions. Show diff stats Hide diff stats

  1. 20  core/manifest/ConfigManifest.php
20  core/manifest/ConfigManifest.php
@@ -59,15 +59,13 @@ public function __construct($base, $includeTests = false, $forceRegen = false )
59 59
 		if (!$forceRegen) {
60 60
 			// The PHP config sources are always needed
61 61
 			$this->phpConfigSources = $this->cache->load('php_config_sources');
62  
-
63  
-			// 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
64  
-			if ($this->variantKeySpec = $this->cache->load('variant_key_spec')) {
65  
-				// Try getting the pre-filtered & merged config for this variant
66  
-				if (!($this->yamlConfig = $this->cache->load('yaml_config_'.$this->variantKey()))) {
67  
-					// 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
68  
-					if ($this->yamlConfigFragments = $this->cache->load('yaml_config_fragments')) {
69  
-						$this->buildYamlConfigVariant();
70  
-					}
  62
+			// Get the variant key spec
  63
+			$this->variantKeySpec = $this->cache->load('variant_key_spec');
  64
+			// Try getting the pre-filtered & merged config for this variant
  65
+			if (!($this->yamlConfig = $this->cache->load('yaml_config_'.$this->variantKey()))) {
  66
+				// 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
  67
+				if ($this->yamlConfigFragments = $this->cache->load('yaml_config_fragments')) {
  68
+					$this->buildYamlConfigVariant();
71 69
 				}
72 70
 			}
73 71
 		}
@@ -122,6 +120,10 @@ public function variantKey() {
122 120
 	 * @param bool $cache Cache the result.
123 121
 	 */
124 122
 	public function regenerate($includeTests = false, $cache = true) {
  123
+		$this->phpConfigSources = array();
  124
+		$this->yamlConfigFragments = array();
  125
+		$this->variantKeySpec = array();
  126
+
125 127
 		$finder = new ManifestFileFinder();
126 128
 		$finder->setOptions(array(
127 129
 			'name_regex'    => '/_config.php$/',

0 notes on commit 5e79e81

Please sign in to comment.
Something went wrong with that request. Please try again.