Skip to content

Commit ca4fce4

Browse files
IONOS(base): add redirect for upgrade page if needed
in case you dont want to display upgrade button to users you can redirect them to other location (e.g. dedicated maintenance page) set desired location via ./occ config:system:set --type string --value /maintenance -- upgrade.redirect_upgradepage_to_location Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
1 parent b6a6f74 commit ca4fce4

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lib/base.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ public static function checkMaintenanceMode(\OC\SystemConfig $systemConfig): voi
257257
private static function printUpgradePage(\OC\SystemConfig $systemConfig): void {
258258
$cliUpgradeLink = $systemConfig->getValue('upgrade.cli-upgrade-link', '');
259259
$disableWebUpdater = $systemConfig->getValue('upgrade.disable-web', false);
260+
$redirectUpgradePage = $systemConfig->getValue('upgrade.redirect_upgradepage_to_location', null);
261+
260262
$tooBig = false;
261263
if (!$disableWebUpdater) {
262264
$apps = Server::get(\OCP\App\IAppManager::class);
@@ -292,6 +294,13 @@ private static function printUpgradePage(\OC\SystemConfig $systemConfig): void {
292294
$ignoreTooBigWarning = isset($_GET['IKnowThatThisIsABigInstanceAndTheUpdateRequestCouldRunIntoATimeoutAndHowToRestoreABackup']) &&
293295
$_GET['IKnowThatThisIsABigInstanceAndTheUpdateRequestCouldRunIntoATimeoutAndHowToRestoreABackup'] === 'IAmSuperSureToDoThis';
294296

297+
if ($redirectUpgradePage !== null) {
298+
http_response_code(302);
299+
header('X-Nextcloud-needsDbUpgrade: 1');
300+
header("Location: ${redirectUpgradePage}#" . time());
301+
die();
302+
}
303+
295304
if ($disableWebUpdater || ($tooBig && !$ignoreTooBigWarning)) {
296305
// send http status 503
297306
http_response_code(503);

0 commit comments

Comments
 (0)