Redirect ACP IndexPage to FirstTimeSetup until submitted
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 6 Mar 2023 13:21:54 +0000 (14:21 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 17 Apr 2023 16:45:09 +0000 (18:45 +0200)
wcfsetup/install/files/lib/acp/form/FirstTimeSetupForm.class.php
wcfsetup/install/files/lib/acp/page/IndexPage.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php

index cef8d597c9d34b3c603481f243bbc9970b2ff7d9..ef8ad697348d4e7703b473fcc4f4430010eed90a 100644 (file)
@@ -83,6 +83,7 @@ class FirstTimeSetupForm extends AbstractOptionListForm
 
         $saveOptions = $this->optionHandler->save('wcf.acp.option', 'wcf.acp.option.option');
         $saveOptions[Option::getOptionByName('offline')->optionID] = 0;
+        $saveOptions[Option::getOptionByName('first_time_setup_state')->optionID] = 1;
         $this->objectAction = new OptionAction([], 'updateAll', ['data' => $saveOptions]);
         $this->objectAction->executeAction();
         $this->saved();
index c4d076c7c45ea5f34d758c8ee6dd9b27eeaed960..6a4d3f241a31c3420f1019d5379e9c2f7cc223b1 100755 (executable)
@@ -2,6 +2,7 @@
 
 namespace wcf\acp\page;
 
+use wcf\acp\form\FirstTimeSetupForm;
 use wcf\data\devtools\missing\language\item\DevtoolsMissingLanguageItemList;
 use wcf\data\package\installation\queue\PackageInstallationQueue;
 use wcf\data\user\User;
@@ -13,6 +14,7 @@ use wcf\system\Environment;
 use wcf\system\registry\RegistryHandler;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
+use wcf\util\HeaderUtil;
 
 /**
  * Shows the welcome page in admin control panel.
@@ -217,6 +219,14 @@ class IndexPage extends AbstractPage
             exit;
         }
 
+        if (\FIRST_TIME_SETUP_STATE != 1) {
+            HeaderUtil::redirect(LinkHandler::getInstance()->getControllerLink(
+                FirstTimeSetupForm::class,
+            ));
+
+            exit;
+        }
+
         // show page
         parent::show();
     }
index d8dfd54f93e22acbd52ca63a6257a37e8b15a300..49b3c17a6c753895e15e55c74590c080afe76696 100644 (file)
@@ -347,6 +347,10 @@ class PackageInstallationDispatcher
             0,
             'offline',
         ]);
+        $statement->execute([
+            1,
+            'first_time_setup_state',
+        ]);
 
         foreach (DevtoolsSetup::getInstance()->getOptionOverrides() as $optionName => $optionValue) {
             $statement->execute([