diff options
-rw-r--r-- | core/Config.php | 4 | ||||
-rw-r--r-- | core/Config/IniFileChain.php | 15 | ||||
-rw-r--r-- | tests/PHPUnit/Unit/Config/IniFileChainCacheTest.php | 3 |
3 files changed, 15 insertions, 7 deletions
diff --git a/core/Config.php b/core/Config.php index 906bbb1652..7a24ca4038 100644 --- a/core/Config.php +++ b/core/Config.php @@ -11,6 +11,8 @@ namespace Piwik; use Exception; use Piwik\Application\Kernel\GlobalSettingsProvider; +use Piwik\Config\Cache; +use Piwik\Config\IniFileChain; use Piwik\Container\StaticContainer; use Piwik\Exception\MissingFilePermissionException; use Piwik\ProfessionalServices\Advertising; @@ -431,6 +433,8 @@ class Config throw $this->getConfigNotWritableException(); } + $this->settings->getIniFileChain()->deleteConfigCache(); + /** * Triggered when a INI config file is changed on disk. * diff --git a/core/Config/IniFileChain.php b/core/Config/IniFileChain.php index db087edca1..94ef276d58 100644 --- a/core/Config/IniFileChain.php +++ b/core/Config/IniFileChain.php @@ -11,7 +11,6 @@ use Piwik\Common; use Piwik\Ini\IniReader; use Piwik\Ini\IniReadingException; use Piwik\Ini\IniWriter; -use Piwik\Url; /** * Manages a list of INI files where the settings in each INI file merge with or override the @@ -213,6 +212,7 @@ class IniFileChain if (!empty($userSettingsFile) && !empty($GLOBALS['ENABLE_CONFIG_PHP_CACHE'])) { $cache = new Cache(); $values = $cache->doFetch(self::CONFIG_CACHE_KEY); + if (!empty($values) && isset($values['mergedSettings']) && isset($values['settingsChain'])) { @@ -256,6 +256,14 @@ class IniFileChain } } + public function deleteConfigCache() + { + if (!empty($GLOBALS['ENABLE_CONFIG_PHP_CACHE'])) { + $cache = new Cache(); + $cache->doDelete(IniFileChain::CONFIG_CACHE_KEY); + } + } + private function copy($merged) { $copy = array(); @@ -502,11 +510,6 @@ class IniFileChain private function dumpSettings($values, $header) { - if (!empty($GLOBALS['ENABLE_CONFIG_PHP_CACHE'])) { - $cache = new Cache(); - $cache->doDelete(self::CONFIG_CACHE_KEY); - } - $values = $this->encodeValues($values); $writer = new IniWriter(); diff --git a/tests/PHPUnit/Unit/Config/IniFileChainCacheTest.php b/tests/PHPUnit/Unit/Config/IniFileChainCacheTest.php index 8b0d0de1c0..7d13559914 100644 --- a/tests/PHPUnit/Unit/Config/IniFileChainCacheTest.php +++ b/tests/PHPUnit/Unit/Config/IniFileChainCacheTest.php @@ -152,8 +152,9 @@ class IniFileChainCacheTest extends IniFileChainTest $this->assertNotEmpty($value); // dumping the cache should delete it + $fileChain = new TestIniFileChain($defaultSettingFiles, $userSettingsFile); - $fileChain->dump(''); + $fileChain->deleteConfigCache(); $value = $this->cache->doFetch(IniFileChain::CONFIG_CACHE_KEY); $this->assertEquals(false, $value); |