Fixed additional data recognition
authorAlexander Ebert <ebert@woltlab.com>
Thu, 3 Nov 2011 17:26:21 +0000 (18:26 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 3 Nov 2011 17:26:21 +0000 (18:26 +0100)
Fixes #242
Fixes #243

wcfsetup/install/files/lib/system/package/plugin/ObjectTypePackageInstallationPlugin.class.php

index d82c43c0667dd33b3e0d7bb7562243000c606331..a1aba22693027f103d88f4a6ae6bc301d44ef007 100644 (file)
@@ -29,6 +29,12 @@ class ObjectTypePackageInstallationPlugin extends AbstractXMLPackageInstallation
         */     
        public $tagName = 'type';
        
+       /**
+        * list of reserved tags
+        * @var array
+        */
+       public static $reservedTags = array('classname', 'definitionname');
+       
        /**
         * Gets the definition id by name
         * 
@@ -73,11 +79,16 @@ class ObjectTypePackageInstallationPlugin extends AbstractXMLPackageInstallation
         * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport()
         */
        protected function prepareImport(array $data) {
+               $additionalData = array();
+               foreach ($data['elements'] as $tagName => $nodeValue) {
+                       if (!in_array($tagName, self::$reservedTags)) $additionalData[$tagName] = $nodeValue;
+               }
+               
                return array(
                        'definitionID' => $this->getDefinitionID($data['elements']['definitionname']),
                        'objectType' => $data['elements']['name'],
                        'className' => (isset($data['elements']['classname']) ? $data['elements']['classname'] : ''),
-                       'additionalData' => serialize(isset($data['elements']['additionaldata']) ? $data['elements']['additionaldata'] : array())
+                       'additionalData' => serialize($additionalData)
                );
        }