diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-07-15 09:07:15 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-07-15 09:07:15 +0400 |
commit | 1ad9203f0186fb96b1a1149c49f0deb5c6e1a35e (patch) | |
tree | 6dfe119b363bdf3488bcb0488fe1b9198c803ef6 /core | |
parent | b36f5c6ebb452c3773192130b907287d263b4788 (diff) |
Making Plugin enable/disable work for a theme
Diffstat (limited to 'core')
-rw-r--r-- | core/AssetManager.php | 20 | ||||
-rw-r--r-- | core/PluginsManager.php | 2 | ||||
-rw-r--r-- | core/View.php | 2 |
3 files changed, 15 insertions, 9 deletions
diff --git a/core/AssetManager.php b/core/AssetManager.php index 518d3110a1..a87db2a3f0 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); } @@ -76,6 +71,19 @@ class Piwik_AssetManager } /** + * 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. * * @throws Exception if a file can not be opened in write mode @@ -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 c09988452f..ab341e5654 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 00d30ebc55..183b9601a7 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( |