Added importer for smiley categories
authorMarcel Werk <burntime@woltlab.com>
Wed, 13 Nov 2013 11:56:57 +0000 (12:56 +0100)
committerMarcel Werk <burntime@woltlab.com>
Wed, 13 Nov 2013 11:56:57 +0000 (12:56 +0100)
com.woltlab.wcf/objectType.xml
wcfsetup/install/files/lib/system/importer/SmileyCategoryImporter.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/importer/SmileyImporter.class.php

index 3226a065506452a106c2f8455b72f9d2829cd132..0824bfb07d149eda16f3687b346200608b2cdd05 100644 (file)
                        <definitionname>com.woltlab.wcf.importer</definitionname>
                        <classname><![CDATA[wcf\system\importer\SmileyImporter]]></classname>
                </type>
+               <type>
+                       <name>com.woltlab.wcf.smiley.category</name>
+                       <definitionname>com.woltlab.wcf.importer</definitionname>
+                       <classname><![CDATA[wcf\system\importer\SmileyCategoryImporter]]></classname>
+               </type>
                <!-- /importers -->
                
                <!-- rebuild data workers -->
diff --git a/wcfsetup/install/files/lib/system/importer/SmileyCategoryImporter.class.php b/wcfsetup/install/files/lib/system/importer/SmileyCategoryImporter.class.php
new file mode 100644 (file)
index 0000000..4c3f48d
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+namespace wcf\system\importer;
+use wcf\data\object\type\ObjectTypeCache;
+
+/**
+ * Imports smiley categories.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2013 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.importer
+ * @category   Community Framework
+ */
+class SmileyCategoryImporter extends AbstractCategoryImporter {
+       /**
+        * @see \wcf\system\importer\AbstractCommentImporter::$objectTypeName
+        */
+       protected $objectTypeName = 'com.woltlab.wcf.smiley.category';
+       
+       /**
+        * Creates a new SmileyCategoryImporter object.
+        */
+       public function __construct() {
+               $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.category', 'com.woltlab.wcf.bbcode.smiley');
+               $this->objectTypeID = $objectType->objectTypeID;
+       }
+}
index 72d5248f4c30ee1e9a3cb7dab062861528b2043c..09cd00f91e055d6ea8cce5b37e0b0bdde498ddc8 100644 (file)
@@ -73,6 +73,9 @@ class SmileyImporter extends AbstractImporter {
                        $data['aliases'] = implode("\n", $aliases);
                }
                
+               // get category id
+               if (!empty($data['categoryID'])) $data['categoryID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.smiley.category', $data['categoryID']);
+               
                // save smiley
                $smiley = SmileyEditor::create($data);