summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-10-16 15:54:57 +0200
committerLukas Reschke <lukas@owncloud.com>2014-10-16 15:54:57 +0200
commita37dcf94fdc6a86faaa45a1a720b40048afbcbfa (patch)
tree3964b393535dba5e6a262b98880a22e09e0074ab
parentdf5b98afa85c9cd0ff9a8623608af46620215474 (diff)
parenta04159090fcba6a503d749014c39b81a75dd2f7b (diff)
downloadnextcloud-server-a37dcf94fdc6a86faaa45a1a720b40048afbcbfa.tar.gz
nextcloud-server-a37dcf94fdc6a86faaa45a1a720b40048afbcbfa.zip
Merge pull request #11591 from owncloud/addAppVersionToCSSandJS
Add app version to JS and CSS
-rw-r--r--lib/private/templatelayout.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/private/templatelayout.php b/lib/private/templatelayout.php
index e9172fd2da5..9f996e19f81 100644
--- a/lib/private/templatelayout.php
+++ b/lib/private/templatelayout.php
@@ -14,6 +14,8 @@ use Assetic\Filter\CssImportFilter;
class OC_TemplateLayout extends OC_Template {
+ private static $versionHash = '';
+
/**
* @param string $renderas
* @param string $appid application id
@@ -70,26 +72,25 @@ class OC_TemplateLayout extends OC_Template {
parent::__construct('core', 'layout.base');
}
- $versionParameter = '?v=' . md5(implode(OC_Util::getVersion()));
+ if(empty(self::$versionHash)) {
+ self::$versionHash = md5(implode(',', OC_App::getAppVersions()));
+ }
+
$useAssetPipeline = $this->isAssetPipelineEnabled();
if ($useAssetPipeline) {
-
- $this->append( 'jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
-
+ $this->append( 'jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
$this->generateAssets();
-
} else {
-
// Add the js files
$jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array(), false);
if (OC_Config::getValue('installed', false) && $renderas!='error') {
- $this->append( 'jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
+ $this->append( 'jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
}
foreach($jsfiles as $info) {
$web = $info[1];
$file = $info[2];
- $this->append( 'jsfiles', $web.'/'.$file . $versionParameter);
+ $this->append( 'jsfiles', $web.'/'.$file . '?v=' . self::$versionHash);
}
// Add the css files
@@ -99,7 +100,7 @@ class OC_TemplateLayout extends OC_Template {
$web = $info[1];
$file = $info[2];
- $this->append( 'cssfiles', $web.'/'.$file . $versionParameter);
+ $this->append( 'cssfiles', $web.'/'.$file . '?v=' . self::$versionHash);
}
}
}
@@ -202,6 +203,8 @@ class OC_TemplateLayout extends OC_Template {
}, $files);
sort($files);
+ // include the apps' versions hash to invalidate the cached assets
+ $files[]= self::$versionHash;
return hash('md5', implode('', $files));
}