Allow only updating controller
authorAlexander Ebert <ebert@woltlab.com>
Thu, 26 Nov 2015 18:42:22 +0000 (19:42 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 26 Nov 2015 18:42:22 +0000 (19:42 +0100)
wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php

index 34c3e304102c702022c1b93c1e14cfd01705dc17..98806f9288a415c8a7c74e26737d35d31f166db4 100644 (file)
@@ -170,8 +170,20 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                $content = $data['content'];
                unset($data['content']);
                
-               // import or update action
-               $object = parent::import($row, $data);
+               if ($row !== false) {
+                       // allow only updating of controller, everything else would overwrite user modifications
+                       if (!empty($data['controller'])) {
+                               $object = parent::import($row, ['controller' => $data['controller']]);
+                       }
+                       else {
+                               $baseClass = call_user_func(array($this->className, 'getBaseClass'));
+                               $object = new $baseClass(null, $row);
+                       }
+               }
+               else {
+                       // import
+                       $object = parent::import($row, $data);
+               }
                
                // store content for later import
                $this->content[$object->pageID] = $content;