Prevent changes to the visibility settings of system boxes during an update/upgrade
authorAlexander Ebert <ebert@woltlab.com>
Wed, 29 Jan 2020 13:38:56 +0000 (14:38 +0100)
committerMarcel Werk <burntime@woltlab.com>
Wed, 12 Aug 2020 15:46:39 +0000 (17:46 +0200)
wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php

index d2784b1c5c684d9ca5bbb8750f268af602cb19db..e5a4d84e55353b7692b05de004971b12b51d1efd 100644 (file)
@@ -287,6 +287,13 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                        $box = new Box(null, $row);
                }
                else {
+                       // Updating 'system' type boxes is allowed, but we must not modify
+                       // the visibility settings in order to preserve user modifications.
+                       if (!empty($row) && $row['boxType'] === 'system') {
+                               unset($data['visibleEverywhere']);
+                               unset($this->visibilityExceptions[$data['identifier']]);
+                       }
+                       
                        $box = parent::import($row, $data);
                }