diff --git a/core/AssetManager.php b/core/AssetManager.php index 518d3110a1760fe81b215e67de5fdd00e738c39e..a87db2a3f078da2d5841c33070028801e48e7143 100644 --- a/core/AssetManager.php +++ b/core/AssetManager.php @@ -52,11 +52,6 @@ class Piwik_AssetManager */ public static function getCssAssets() { - if (self::getDisableMergedAssets()) { - // Individual includes mode - self::removeMergedAsset(self::MERGED_CSS_FILE); - self::generateMergedCssFile(); - } return sprintf(self::CSS_IMPORT_DIRECTIVE, self::GET_CSS_MODULE_ACTION); } @@ -75,6 +70,19 @@ class Piwik_AssetManager return sprintf(self::JS_IMPORT_DIRECTIVE, self::GET_JS_MODULE_ACTION); } + /** + * Assets are cached in the browser and Piwik server returns 304 after initial download. + * when the Cache buster string changes, the assets will be re-generated + * + * @return string + */ + public static function generateAssetsCacheBuster() + { + $pluginList = md5(implode(",", Piwik_PluginsManager::getInstance()->getLoadedPluginsName())); + $cacheBuster = md5(Piwik_Common::getSalt() . $pluginList . PHP_VERSION . Piwik_Version::VERSION); + return $cacheBuster; + } + /** * Generate the merged css file. * @@ -92,7 +100,7 @@ class Piwik_AssetManager $rootDirectoryLen = strlen($rootDirectory); if(!class_exists("lessc")) { - throw new Exception("Less was added to composer during 2.0. ==> Excecute this command to update composer packages: \$ php composer.phar update"); + throw new Exception("Less was added to composer during 2.0. ==> Execute this command to update composer packages: \$ php composer.phar update"); } $less = new lessc; diff --git a/core/PluginsManager.php b/core/PluginsManager.php index c09988452f3904ce575c34eeecfb61d8a6cd07cc..ab341e5654ee83a27bcb6d6d0d13cd0ae782b968 100644 --- a/core/PluginsManager.php +++ b/core/PluginsManager.php @@ -188,7 +188,6 @@ class Piwik_PluginsManager } } - // Delete merged js/css files to force regenerations to exclude the deactivated plugin Piwik_Config::getInstance()->forceSave(); Piwik::deleteAllCacheOnUpdate(); } @@ -248,7 +247,6 @@ class Piwik_PluginsManager $this->updatePluginsConfig($plugins); Piwik_Config::getInstance()->forceSave(); - // Delete merged js/css files to force regenerations to include the activated plugin Piwik::deleteAllCacheOnUpdate(); } diff --git a/core/View.php b/core/View.php index 00d30ebc554537271726b8e2d127b40b86b63d04..183b9601a7d2e4b639aa6a9cb75c1a857661084c 100644 --- a/core/View.php +++ b/core/View.php @@ -143,7 +143,7 @@ class Piwik_View implements Piwik_View_Interface protected function applyFilter_cacheBuster($output) { - $cacheBuster = md5(Piwik_Common::getSalt() . PHP_VERSION . Piwik_Version::VERSION); + $cacheBuster = Piwik_AssetManager::generateAssetsCacheBuster(); $tag = 'cb=' . $cacheBuster; $pattern = array(