summaryrefslogtreecommitdiffstats
path: root/lib/private/TemplateLayout.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-12-11 15:03:55 +0100
committerMorris Jobke <hey@morrisjobke.de>2017-12-11 15:03:55 +0100
commitce69d9ec71b3052fc9a4aa64222baef6d36a9f28 (patch)
treecc48a059602e167349614070370835c0e6ee02e3 /lib/private/TemplateLayout.php
parentf4d7afc9500355e94e2ac1c7c921101971d0d29f (diff)
downloadnextcloud-server-ce69d9ec71b3052fc9a4aa64222baef6d36a9f28.tar.gz
nextcloud-server-ce69d9ec71b3052fc9a4aa64222baef6d36a9f28.zip
Fix 500 on setup page
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/TemplateLayout.php')
-rw-r--r--lib/private/TemplateLayout.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index f0f1378a052..997980aa5d7 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -105,7 +105,7 @@ class TemplateLayout extends \OC_Template {
$this->assign('userAvatarSet', false);
} else {
$this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
- $this->assign('userAvatarVersion', \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0));
+ $this->assign('userAvatarVersion', $this->config->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0));
}
} else if ($renderAs == 'error') {
@@ -142,7 +142,7 @@ class TemplateLayout extends \OC_Template {
\OC::$server->getAppManager(),
\OC::$server->getSession(),
\OC::$server->getUserSession()->getUser(),
- \OC::$server->getConfig(),
+ $this->config,
\OC::$server->getGroupManager(),
\OC::$server->getIniWrapper(),
\OC::$server->getURLGenerator()
@@ -199,18 +199,26 @@ class TemplateLayout extends \OC_Template {
* @return string
*/
protected function getVersionHashSuffix($path = false, $file = false) {
- if (\OC::$server->getConfig()->getSystemValue('debug', false)) {
+ if ($this->config->getSystemValue('debug', false)) {
// allows chrome workspace mapping in debug mode
return "";
}
- $v = \OC_App::getAppVersions();
+ $themingSuffix = '';
+ $v = [];
+
+ if ($this->config->getSystemValue('installed', false)) {
+ if (\OC::$server->getAppManager()->isInstalled('theming')) {
+ $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
+ }
+ $v = \OC_App::getAppVersions();
+ }
// Try the webroot path for a match
if ($path !== false && $path !== '') {
$appName = $this->getAppNamefromPath($path);
if(array_key_exists($appName, $v)) {
$appVersion = $v[$appName];
- return '?v=' . substr(md5($appVersion), 0, 8) . '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
+ return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
}
}
// fallback to the file path instead
@@ -218,14 +226,11 @@ class TemplateLayout extends \OC_Template {
$appName = $this->getAppNamefromPath($file);
if(array_key_exists($appName, $v)) {
$appVersion = $v[$appName];
- return '?v=' . substr(md5($appVersion), 0, 8) . '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
+ return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix;
}
}
- if ($this->config->getSystemValue('installed', false) && \OC::$server->getAppManager()->isInstalled('theming')) {
- return '?v=' . self::$versionHash . '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
- }
- return '?v=' . self::$versionHash;
+ return '?v=' . self::$versionHash . $themingSuffix;
}
/**