From 03aa9e4b41c64e690e6ab5a4d0e06a0f230afe09 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Fri, 28 Jun 2013 11:25:14 +1200 Subject: [PATCH] FIX ConfigManifest caching to not use existing cache from wrong $base --- core/manifest/ConfigManifest.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/core/manifest/ConfigManifest.php b/core/manifest/ConfigManifest.php index cf1d13008..b8cffb2c2 100644 --- a/core/manifest/ConfigManifest.php +++ b/core/manifest/ConfigManifest.php @@ -64,6 +64,7 @@ class SS_ConfigManifest { */ public function __construct($base, $includeTests = false, $forceRegen = false ) { $this->base = $base; + $this->key = sha1($base).'_'; // Get the Zend Cache to load/store cache into $this->cache = SS_Cache::factory('SS_Configuration', 'Core', array( @@ -74,14 +75,14 @@ class SS_ConfigManifest { // Unless we're forcing regen, try loading from cache if (!$forceRegen) { // The PHP config sources are always needed - $this->phpConfigSources = $this->cache->load('php_config_sources'); + $this->phpConfigSources = $this->cache->load($this->key.'php_config_sources'); // Get the variant key spec - $this->variantKeySpec = $this->cache->load('variant_key_spec'); + $this->variantKeySpec = $this->cache->load($this->key.'variant_key_spec'); // 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($this->key.'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 - if ($this->yamlConfigFragments = $this->cache->load('yaml_config_fragments')) { + if ($this->yamlConfigFragments = $this->cache->load($this->key.'yaml_config_fragments')) { $this->buildYamlConfigVariant(); } } @@ -165,9 +166,9 @@ class SS_ConfigManifest { $this->buildVariantKeySpec(); if ($cache) { - $this->cache->save($this->phpConfigSources, 'php_config_sources'); - $this->cache->save($this->yamlConfigFragments, 'yaml_config_fragments'); - $this->cache->save($this->variantKeySpec, 'variant_key_spec'); + $this->cache->save($this->phpConfigSources, $this->key.'php_config_sources'); + $this->cache->save($this->yamlConfigFragments, $this->key.'yaml_config_fragments'); + $this->cache->save($this->variantKeySpec, $this->key.'variant_key_spec'); } } @@ -493,7 +494,7 @@ class SS_ConfigManifest { } if ($cache) { - $this->cache->save($this->yamlConfig, 'yaml_config_'.$this->variantKey()); + $this->cache->save($this->yamlConfig, $this->key.'yaml_config_'.$this->variantKey()); } }