Mark the first time setup as completed on upgrade
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 10 May 2023 08:13:00 +0000 (10:13 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 10 May 2023 08:13:33 +0000 (10:13 +0200)
Resolves #5500

com.woltlab.wcf/package.xml
wcfsetup/install/files/acp/update_com.woltlab.wcf_6.0_skipFirstTimeSetup.php [new file with mode: 0644]

index 4c467f3c0f5f8e5e22840da9dc82659800cf1ba1..3cf90c08b90ff095567fafabab8f4802eb4a6806 100644 (file)
@@ -79,6 +79,7 @@ tar cvf com.woltlab.wcf/files_pre_check.tar -C wcfsetup/install/files/ \
 
                <!-- Make all the new options available as early as possible. -->
                <instruction type="option" run="standalone" />
+               <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_6.0_skipFirstTimeSetup.php</instruction>
 
                <!-- Run before the database migrations, because the data is gone otherwise. -->
                <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_6.0_landingPage.php</instruction>
diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_6.0_skipFirstTimeSetup.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_6.0_skipFirstTimeSetup.php
new file mode 100644 (file)
index 0000000..1a281a1
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * Marks the first time setup as completed during the upgrade.
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2023 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ */
+
+use wcf\data\option\Option;
+use wcf\data\option\OptionAction;
+
+$objectAction = new OptionAction(
+    [],
+    'updateAll',
+    [
+        'data' => [
+            Option::getOptionByName('first_time_setup_state')->optionID => -1,
+        ],
+    ]
+);
+$objectAction->executeAction();