Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 500 on setup page #7449

Merged
merged 1 commit into from
Dec 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions lib/private/TemplateLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,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));
}

} else if ($renderAs == 'error') {
Expand Down Expand Up @@ -142,7 +142,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 @@ -199,33 +199,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();
Copy link
Member Author

@MorrisJobke MorrisJobke Dec 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That one caused it - it's now wrapped into an "is installed" check. Otherwise the versions are empty and just skipped by the added checks below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be fair I just noticed there is a direct version checker in https://github.com/nextcloud/server/blob/master/lib/private/legacy/app.php#L572

I never saw this since documentation is nowhere to be found 😢

$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