diff --git a/core/AssetManager.php b/core/AssetManager.php index c026be4ba2933a72b752e86de811a3364059c99d..90185a43f3c92f54b9de7691525f2108244e5077 100644 --- a/core/AssetManager.php +++ b/core/AssetManager.php @@ -373,7 +373,7 @@ class AssetManager extends Singleton /** * @return UIAsset */ - private function getMergedStylesheetAsset() + public function getMergedStylesheetAsset() { return $this->getMergedUIAsset(self::MERGED_CSS_FILE); } diff --git a/core/Option.php b/core/Option.php index 5d39866454916bd38641320b5ba60804e8312e92..7f6ae85cab459ee47a50bc47cfa77c9084f1e347 100644 --- a/core/Option.php +++ b/core/Option.php @@ -163,7 +163,7 @@ class Option return $this->all[$name]; } $value = Db::fetchOne('SELECT option_value ' . - 'FROM `' . Common::prefixTable('option') . '`' . + 'FROM `' . Common::prefixTable('option') . '` ' . 'WHERE option_name = ?', $name); if ($value === false) { return false; diff --git a/core/View.php b/core/View.php index 8b784822019f4d950577ba9ef35fcd2ef2b84d51..6f140d4b91c5c0df0f12e26407624aaf00f1a319 100644 --- a/core/View.php +++ b/core/View.php @@ -252,8 +252,18 @@ class View implements ViewInterface protected function applyFilter_cacheBuster($output) { - $cacheBuster = UIAssetCacheBuster::getInstance()->piwikVersionBasedCacheBuster(); - $tag = 'cb=' . $cacheBuster; + $assetManager = AssetManager::getInstance(); + + $stylesheet = $assetManager->getMergedStylesheetAsset(); + if ($stylesheet->exists()) { + $content = $stylesheet->getContent(); + } else { + $content = $assetManager->getMergedStylesheet()->getContent(); + } + + $cacheBuster = UIAssetCacheBuster::getInstance(); + $tagJs = 'cb=' . $cacheBuster->piwikVersionBasedCacheBuster(); + $tagCss = 'cb=' . $cacheBuster->md5BasedCacheBuster($content); $pattern = array( '~<script type=[\'"]text/javascript[\'"] src=[\'"]([^\'"]+)[\'"]>~', @@ -264,9 +274,9 @@ class View implements ViewInterface ); $replace = array( - '<script type="text/javascript" src="$1?' . $tag . '">', - '<script type="text/javascript" src="$1?' . $tag . '">', - '<link rel="stylesheet" type="text/css" href="$1?' . $tag . '" />', + '<script type="text/javascript" src="$1?' . $tagJs . '">', + '<script type="text/javascript" src="$1?' . $tagJs . '">', + '<link rel="stylesheet" type="text/css" href="$1?' . $tagCss . '" />', '$1="index.php?module=$2&action=$3&cb=', );