diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-05-16 03:01:25 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-05-16 03:01:25 +0400 |
commit | c3c791498104c56c9bc94ea1754ae17d0decda4c (patch) | |
tree | 701bfeb9f4c1e5058373dc2a26af917456519678 | |
parent | 12c2146a1e2cac328088127702e803f88aaec603 (diff) | |
parent | 034d6da03c073d35fe87a6aa7647d6a614d912a7 (diff) |
Merge branch 'master' of github.com:piwik/piwik
-rw-r--r-- | core/AssetManager.php | 2 | ||||
-rw-r--r-- | core/Option.php | 2 | ||||
-rw-r--r-- | core/View.php | 20 |
3 files changed, 17 insertions, 7 deletions
diff --git a/core/AssetManager.php b/core/AssetManager.php index c026be4ba2..90185a43f3 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 5d39866454..7f6ae85cab 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 8b78482201..6f140d4b91 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=', ); |