Migrate the style system earlier to avoid bricking the ACP
authorAlexander Ebert <ebert@woltlab.com>
Tue, 17 Oct 2023 15:11:37 +0000 (17:11 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 17 Oct 2023 15:11:37 +0000 (17:11 +0200)
See https://www.woltlab.com/community/thread/302169/

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

index a9c707ab3bb3a0697d16664c6b9c75f405d433cd..0694d56fdb8182fdc01405ef016aee7a7004e537 100644 (file)
@@ -72,6 +72,10 @@ tar cvf com.woltlab.wcf/files_pre_check.tar -C wcfsetup/install/files/ \
                <!-- Required for wcf1_package_installation_file_log. -->
                <instruction type="database" run="standalone">acp/database/update_com.woltlab.wcf_6.0_pre.php</instruction>
 
+               <!-- Add the dark mode support first, because otherwise a failed migration would brick the ACP. -->
+               <instruction type="database" run="standalone">acp/database/update_com.woltlab.wcf_6.0_style.php</instruction>
+               <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_6.0_styleVariables.php</instruction>
+
                <!-- Deploy new application code. -->
                <instruction type="file" />
                <instruction type="acpTemplate" />
@@ -97,8 +101,6 @@ tar cvf com.woltlab.wcf/files_pre_check.tar -C wcfsetup/install/files/ \
                <instruction type="database" run="standalone">acp/database/update_com.woltlab.wcf_6.0_trackedVisit_step2.php</instruction>
                <instruction type="database" run="standalone">acp/database/update_com.woltlab.wcf_6.0_trackedVisit_step3.php</instruction>
 
-               <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_6.0_styleVariables.php</instruction>
-
                <!-- Deploy the new application code again to build the hashes in wcf1_package_installation_file_log. -->
                <instruction type="file" />
 
index e14a707e88d0061d81fc859e7947cdb805692f6d..1d030f413f1da856d9fba087494da7c3e9ddadf2 100644 (file)
@@ -112,15 +112,6 @@ return [
         ->columns([
             EnumDatabaseTableColumn::create('apiVersion')
                 ->drop(),
-            DefaultFalseBooleanDatabaseTableColumn::create('hasDarkMode'),
-        ]),
-    PartialDatabaseTable::create('wcf1_style_variable')
-        ->columns([
-            MediumtextDatabaseTableColumn::create('defaultValueDarkMode'),
-        ]),
-    PartialDatabaseTable::create('wcf1_style_variable_value')
-        ->columns([
-            MediumtextDatabaseTableColumn::create('variableValueDarkMode'),
         ]),
     PartialDatabaseTable::create('wcf1_user_group_option')
         ->columns([
diff --git a/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.0_style.php b/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.0_style.php
new file mode 100644 (file)
index 0000000..1fa8335
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+/**
+ * Updates the database layout for the styles during the update from 5.5 to 6.0.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2023 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ */
+
+use wcf\system\database\table\column\DefaultFalseBooleanDatabaseTableColumn;
+use wcf\system\database\table\column\MediumtextDatabaseTableColumn;
+use wcf\system\database\table\PartialDatabaseTable;
+
+return [
+    PartialDatabaseTable::create('wcf1_style')
+        ->columns([
+            DefaultFalseBooleanDatabaseTableColumn::create('hasDarkMode'),
+        ]),
+    PartialDatabaseTable::create('wcf1_style_variable')
+        ->columns([
+            MediumtextDatabaseTableColumn::create('defaultValueDarkMode'),
+        ]),
+    PartialDatabaseTable::create('wcf1_style_variable_value')
+        ->columns([
+            MediumtextDatabaseTableColumn::create('variableValueDarkMode'),
+        ]),
+];