Skip to content

Commit

Permalink
Merge pull request #8689 from nextcloud/12-7449
Browse files Browse the repository at this point in the history
[stable12] Fix 500 on setup page
  • Loading branch information
MorrisJobke authored Mar 6, 2018
2 parents 6acc307 + 51b79a5 commit 36c9b12
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions lib/private/TemplateLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function __construct( $renderAs, $appId = '' ) {
$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));
}

// check if app menu icons should be inverted
Expand Down Expand Up @@ -148,7 +148,7 @@ public function __construct( $renderAs, $appId = '' ) {
\OC::$server->getAppManager(),
\OC::$server->getSession(),
\OC::$server->getUserSession()->getUser(),
\OC::$server->getConfig(),
$this->config,
\OC::$server->getGroupManager(),
\OC::$server->getIniWrapper(),
\OC::$server->getURLGenerator()
Expand Down Expand Up @@ -205,33 +205,38 @@ public function __construct( $renderAs, $appId = '' ) {
* @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
if ($file !== false && $file !== '') {
$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;
}

/**
Expand Down

0 comments on commit 36c9b12

Please sign in to comment.