Fix rescue mode redirect when accessing non-core ACP
authorMarcel Werk <burntime@woltlab.com>
Tue, 13 Feb 2024 15:36:29 +0000 (16:36 +0100)
committerMarcel Werk <burntime@woltlab.com>
Tue, 13 Feb 2024 15:36:29 +0000 (16:36 +0100)
Closes #4520

wcfsetup/install/files/lib/system/WCFACP.class.php

index fd40a546e3e3317da51717a14a3f9cc9acba9d76..acd7e9aaea1dc236569a4a982d185374b7706667 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace wcf\system;
 
+use Laminas\Diactoros\Uri;
 use wcf\system\application\ApplicationHandler;
 use wcf\system\cache\builder\ACPSearchProviderCacheBuilder;
 use wcf\system\event\EventHandler;
@@ -117,7 +118,15 @@ class WCFACP extends WCF
 
         if (self::inRescueMode()) {
             if (!\preg_match('~^/?rescue-mode/~', $pathInfo)) {
-                $redirectURI = self::$rescueModePageURL . 'acp/index.php?rescue-mode/';
+                if (\PACKAGE_ID != 1) {
+                    $uri = new Uri(self::$rescueModePageURL);
+                    $uri = $uri->withPath(FileUtil::getRealPath($uri->getPath() . 'acp/' . \RELATIVE_WCF_DIR));
+                    $pageURL = $uri->__toString();
+                } else {
+                    $pageURL = self::$rescueModePageURL;
+                }
+
+                $redirectURI = $pageURL . 'acp/index.php?rescue-mode/';
 
                 HeaderUtil::redirect($redirectURI);