Skip to content

Commit e668cf1

Browse files
author
Vincent Petry
authored
Merge pull request #25356 from owncloud/checkupgrade-bypass
Bypass upgrade page when occ controller is requested
2 parents 1d10d58 + 89e581a commit e668cf1

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

lib/base.php

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

833833
$request = \OC::$server->getRequest();
834+
// Check if requested URL matches 'index.php/occ'
835+
$isOccControllerRequested = preg_match('|/index\.php$|', $request->getScriptName()) === 1
836+
&& strpos($request->getPathInfo(), '/occ/') === 0;
837+
834838
$requestPath = $request->getRawPathInfo();
835839
if (substr($requestPath, -3) !== '.js') { // we need these files during the upgrade
836840
self::checkMaintenanceMode($request);
837-
self::checkUpgrade();
841+
$needUpgrade = self::checkUpgrade(!$isOccControllerRequested);
838842
}
839843

840844
// emergency app disabling
@@ -852,8 +856,16 @@ public static function handleRequest() {
852856
exit();
853857
}
854858

855-
// Always load authentication apps
856-
OC_App::loadApps(['authentication']);
859+
try {
860+
// Always load authentication apps
861+
OC_App::loadApps(['authentication']);
862+
} catch (\OC\NeedsUpdateException $e) {
863+
if ($isOccControllerRequested && $needUpgrade){
864+
OC::$server->getRouter()->match(\OC::$server->getRequest()->getRawPathInfo());
865+
return;
866+
}
867+
throw $e;
868+
}
857869

858870
// Load minimum set of apps
859871
if (!self::checkUpgrade(false)

0 commit comments

Comments
 (0)