diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2014-01-29 02:43:08 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2014-01-29 02:43:08 +0400 |
commit | ca4779fa8582a7031a149a2c113a322b2c2f2090 (patch) | |
tree | 7bb5da58df24a9814878c3c1d47440c7e494231d /core/AssetManager | |
parent | dc2d18d7192dd70ed54ccba69ea10415c612246e (diff) |
refs #4373 fixes the merged assets file was only generate if it did not exist before and fix it also was not regenerated if a plugin was not updated. Therefore include the version number in the cache buster.
Diffstat (limited to 'core/AssetManager')
-rw-r--r-- | core/AssetManager/UIAssetCacheBuster.php | 15 | ||||
-rw-r--r-- | core/AssetManager/UIAssetMerger.php | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/core/AssetManager/UIAssetCacheBuster.php b/core/AssetManager/UIAssetCacheBuster.php index 8b0f849f6a..632cfd31e0 100644 --- a/core/AssetManager/UIAssetCacheBuster.php +++ b/core/AssetManager/UIAssetCacheBuster.php @@ -20,7 +20,7 @@ class UIAssetCacheBuster extends Singleton /** * Cache buster based on * - Piwik version - * - Loaded plugins + * - Loaded plugins (name and version) * - Super user salt * - Latest * @@ -31,8 +31,17 @@ class UIAssetCacheBuster extends Singleton { $masterFile = PIWIK_INCLUDE_PATH . '/.git/refs/heads/master'; $currentGitHash = file_exists($masterFile) ? @file_get_contents($masterFile) : null; - $pluginList = implode(",", !$pluginNames ? Manager::getInstance()->getLoadedPluginsName() : $pluginNames); - $cacheBuster = md5($pluginList . PHP_VERSION . Version::VERSION . trim($currentGitHash)); + + $pluginNames = !$pluginNames ? Manager::getInstance()->getLoadedPluginsName() : $pluginNames; + sort($pluginNames); + + $pluginsInfo = ''; + foreach ($pluginNames as $pluginName) { + $plugin = Manager::getInstance()->getLoadedPlugin($pluginName); + $pluginsInfo .= $plugin->getPluginName() . $plugin->getVersion() . ','; + } + + $cacheBuster = md5($pluginsInfo . PHP_VERSION . Version::VERSION . trim($currentGitHash)); return $cacheBuster; } diff --git a/core/AssetManager/UIAssetMerger.php b/core/AssetManager/UIAssetMerger.php index 9859210db1..744c4fad2b 100644 --- a/core/AssetManager/UIAssetMerger.php +++ b/core/AssetManager/UIAssetMerger.php @@ -211,6 +211,6 @@ abstract class UIAssetMerger */ private function shouldCompareExistingVersion() { - return $this->isMergedAssetsDisabled(); + return !$this->isMergedAssetsDisabled(); } } |