diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-10-15 11:23:42 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-10-15 14:00:20 +0200 |
commit | 6ccda2ae9890d079b4e7c77b3f04e89b63209ef3 (patch) | |
tree | d2460bb3f7d5db64d5eeae9bd8c6cbf14fa10379 /lib/private | |
parent | dd0b1e83b22492bcfb79fe2b2539f177889ce312 (diff) | |
download | nextcloud-server-6ccda2ae9890d079b4e7c77b3f04e89b63209ef3.tar.gz nextcloud-server-6ccda2ae9890d079b4e7c77b3f04e89b63209ef3.zip |
Add app version to JS and CSS
This leads to the regeneration of the hash in case a single application is updated.
Fixes https://github.com/owncloud/core/issues/11374
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/templatelayout.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/private/templatelayout.php b/lib/private/templatelayout.php index e9172fd2da5..0f8c056139b 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); } } } |