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

Make sure the instance is in maintenance mode before reseting opcache… #34143

Closed
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
6 changes: 3 additions & 3 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -973,10 +973,10 @@ public static function handleRequest() {
self::checkMaintenanceMode($systemConfig);

if (\OCP\Util::needUpgrade()) {
if (function_exists('opcache_reset')) {
opcache_reset();
}
if (!((bool) $systemConfig->getValue('maintenance', false))) {
Copy link
Contributor

@come-nc come-nc Nov 7, 2022

Choose a reason for hiding this comment

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

Am I reading that wrong or is that if the instance is NOT in maintenance mode?

Copy link
Contributor

Choose a reason for hiding this comment

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

!false === true
I think it is correct

Copy link
Contributor

@artonge artonge Nov 7, 2022

Choose a reason for hiding this comment

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

Correction, confused, but you are right

Copy link
Member

@icewind1991 icewind1991 Nov 11, 2022

Choose a reason for hiding this comment

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

I believe come was right here, the false is just the default, so this reads

$maintenanceEnabled =  $systemConfig->getValue('maintenance', false);
if (!$maintenanceEnabled) {
}

This makes sense since the printUpgradePage will get called if an upgrade needs to be ran but hasn't started yet (that enabled maintenance mode).

I'm not sure this change even makes sense, needUpgrade only returns true if the source has been upgraded, but the nextcloud upgrade hasn't ran yet. So the instance is already "down" in that case

if (function_exists('opcache_reset')) {
opcache_reset();
}
self::printUpgradePage($systemConfig);
exit();
}
Expand Down