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)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 29 Jan 2020 13:38:56 +0000 (14:38 +0100)
wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php

index a4831f92f31245802e3fb4503ab4e25b732f9413..8a77cd6cb273e2e765cb76fff21ea38605533c29 100644 (file)
@@ -313,6 +313,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);
                }