summaryrefslogtreecommitdiffstats
path: root/lib/private/TemplateLayout.php
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2017-11-22 13:58:44 +0100
committerMorris Jobke <hey@morrisjobke.de>2017-12-11 14:24:23 +0100
commit820e7b5abac0618755f1aafd5fece78d14bd6789 (patch)
tree4794846babc9288ecaf23d48fcd8efc4bea04588 /lib/private/TemplateLayout.php
parent8ed728c1a2126ac11207c498ce6935ef307b3982 (diff)
downloadnextcloud-server-820e7b5abac0618755f1aafd5fece78d14bd6789.tar.gz
nextcloud-server-820e7b5abac0618755f1aafd5fece78d14bd6789.zip
Use apps versions to generate suffix when possible
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/private/TemplateLayout.php')
-rw-r--r--lib/private/TemplateLayout.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index 4d49522be78..2868d48a911 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -90,7 +90,7 @@ class TemplateLayout extends \OC_Template {
break;
}
}
-
+
foreach($settingsNavigation as $entry) {
if ($entry['active']) {
$this->assign( 'application', $entry['name'] );
@@ -125,7 +125,7 @@ class TemplateLayout extends \OC_Template {
if (empty(self::$versionHash)) {
$v = \OC_App::getAppVersions();
$v['core'] = implode('.', \OCP\Util::getVersion());
- self::$versionHash = md5(implode(',', $v));
+ self::$versionHash = substr(md5(implode(',', $v)), 0, 8);
}
} else {
self::$versionHash = md5('not installed');
@@ -188,16 +188,25 @@ class TemplateLayout extends \OC_Template {
if (substr($file, -strlen('print.css')) === 'print.css') {
$this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
} else {
- $this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
+ $this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web) );
}
}
}
- protected function getVersionHashSuffix() {
- if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
+ protected function getVersionHashSuffix($app=false) {
+ if (\OC::$server->getConfig()->getSystemValue('debug', false)) {
// allows chrome workspace mapping in debug mode
return "";
}
+ if ($app !== false && $app !== '') {
+ $v = \OC_App::getAppVersions();
+ $appName = end(explode('/', $app));
+ if(array_key_exists($appName, $v)) {
+ $appVersion = $v[$appName];
+ return '?v=' . substr(md5(implode(',', $appVersion)), 0, 8) . '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
+ }
+ }
+
if ($this->config->getSystemValue('installed', false) && \OC::$server->getAppManager()->isInstalled('theming')) {
return '?v=' . self::$versionHash . '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
}