Skip to content
Extraits de code Groupes Projets
Valider 1ad9203f rédigé par mattab's avatar mattab
Parcourir les fichiers

Making Plugin enable/disable work for a theme

parent b36f5c6e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -52,11 +52,6 @@ class Piwik_AssetManager ...@@ -52,11 +52,6 @@ class Piwik_AssetManager
*/ */
public static function getCssAssets() 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); return sprintf(self::CSS_IMPORT_DIRECTIVE, self::GET_CSS_MODULE_ACTION);
} }
...@@ -75,6 +70,19 @@ class Piwik_AssetManager ...@@ -75,6 +70,19 @@ class Piwik_AssetManager
return sprintf(self::JS_IMPORT_DIRECTIVE, self::GET_JS_MODULE_ACTION); 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. * Generate the merged css file.
* *
...@@ -92,7 +100,7 @@ class Piwik_AssetManager ...@@ -92,7 +100,7 @@ class Piwik_AssetManager
$rootDirectoryLen = strlen($rootDirectory); $rootDirectoryLen = strlen($rootDirectory);
if(!class_exists("lessc")) { 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; $less = new lessc;
......
...@@ -188,7 +188,6 @@ class Piwik_PluginsManager ...@@ -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_Config::getInstance()->forceSave();
Piwik::deleteAllCacheOnUpdate(); Piwik::deleteAllCacheOnUpdate();
} }
...@@ -248,7 +247,6 @@ class Piwik_PluginsManager ...@@ -248,7 +247,6 @@ class Piwik_PluginsManager
$this->updatePluginsConfig($plugins); $this->updatePluginsConfig($plugins);
Piwik_Config::getInstance()->forceSave(); Piwik_Config::getInstance()->forceSave();
// Delete merged js/css files to force regenerations to include the activated plugin
Piwik::deleteAllCacheOnUpdate(); Piwik::deleteAllCacheOnUpdate();
} }
......
...@@ -143,7 +143,7 @@ class Piwik_View implements Piwik_View_Interface ...@@ -143,7 +143,7 @@ class Piwik_View implements Piwik_View_Interface
protected function applyFilter_cacheBuster($output) protected function applyFilter_cacheBuster($output)
{ {
$cacheBuster = md5(Piwik_Common::getSalt() . PHP_VERSION . Piwik_Version::VERSION); $cacheBuster = Piwik_AssetManager::generateAssetsCacheBuster();
$tag = 'cb=' . $cacheBuster; $tag = 'cb=' . $cacheBuster;
$pattern = array( $pattern = array(
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter