Fix the default value for the custom CSS field
authorAlexander Ebert <ebert@woltlab.com>
Thu, 12 Oct 2023 17:21:30 +0000 (19:21 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 12 Oct 2023 17:21:30 +0000 (19:21 +0200)
See https://www.woltlab.com/community/thread/302018-individuelles-css-und-scss-erg%C3%A4nzend-f%C3%BCr-dunkles-farbschema/

wcfsetup/install/files/acp/update_com.woltlab.wcf_6.0.1.php [new file with mode: 0644]

diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_6.0.1.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_6.0.1.php
new file mode 100644 (file)
index 0000000..a8c42e0
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * Fixes the style variable value of `individualScssDarkMode`.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2023 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ */
+
+use wcf\system\WCF;
+
+// Fix the default value for style variables.
+$sql = "UPDATE  wcf1_style_variable
+        SET     defaultValueDarkMode = ?
+        WHERE   variableName = ?";
+$statement = WCF::getDB()->prepare($sql);
+$statement->execute([null, 'individualScssDarkMode']);
+
+// Fixes any bad values stored for existing styles.
+$sql = "UPDATE  wcf1_style_variable_value
+        SET     variableValueDarkMode = ?
+        WHERE   variableID = (
+                    SELECT  variableID
+                    FROM    wcf1_style_variable
+                    WHERE   variableName = ?
+                )";
+$statement = WCF::getDB()->prepare($sql);
+$statement->execute([null, 'individualScssDarkMode']);