Skip to content

Commit 445a76b

Browse files
VicDeoDeepDiver1975
authored andcommitted
Bypass upgrade page when occ controller is requested (#25363)
1 parent ad67b3f commit 445a76b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

lib/base.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,10 +847,14 @@ public static function handleRequest() {
847847
}
848848

849849
$request = \OC::$server->getRequest();
850+
// Check if requested URL matches 'index.php/occ'
851+
$isOccControllerRequested = preg_match('|/index\.php$|', $request->getScriptName()) === 1
852+
&& strpos($request->getPathInfo(), '/occ/') === 0;
853+
850854
$requestPath = $request->getRawPathInfo();
851855
if (substr($requestPath, -3) !== '.js') { // we need these files during the upgrade
852856
self::checkMaintenanceMode($request);
853-
self::checkUpgrade();
857+
$needUpgrade = self::checkUpgrade(!$isOccControllerRequested);
854858
}
855859

856860
// emergency app disabling
@@ -868,8 +872,16 @@ public static function handleRequest() {
868872
exit();
869873
}
870874

871-
// Always load authentication apps
872-
OC_App::loadApps(['authentication']);
875+
try {
876+
// Always load authentication apps
877+
OC_App::loadApps(['authentication']);
878+
} catch (\OC\NeedsUpdateException $e) {
879+
if ($isOccControllerRequested && $needUpgrade){
880+
OC::$server->getRouter()->match(\OC::$server->getRequest()->getRawPathInfo());
881+
return;
882+
}
883+
throw $e;
884+
}
873885

874886
// Load minimum set of apps
875887
if (!self::checkUpgrade(false)

0 commit comments

Comments
 (0)