From: Marcel Werk Date: Thu, 1 Aug 2013 22:58:37 +0000 (+0200) Subject: Added category importer X-Git-Tag: 2.0.0_Beta_7~67 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=303387f6931c69d5d12816dd45385271a76872cd;p=GitHub%2FWoltLab%2FWCF.git Added category importer --- diff --git a/wcfsetup/install/files/lib/system/importer/AbstractCategoryImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractCategoryImporter.class.php new file mode 100644 index 0000000000..ed26c4faa7 --- /dev/null +++ b/wcfsetup/install/files/lib/system/importer/AbstractCategoryImporter.class.php @@ -0,0 +1,44 @@ + + * @package com.woltlab.wcf + * @subpackage system.importer + * @category Community Framework + */ +class AbstractCategoryImporter implements IImporter { + /** + * object type id for categories + * @var integer + */ + protected $objectTypeID = 0; + + /** + * object type name + * @var integer + */ + protected $objectTypeName = ''; + + /** + * @see wcf\system\importer\IImporter::import() + */ + public function import($oldID, array $data, array $additionalData = array()) { + if (!empty($data['parentCategoryID'])) $data['parentCategoryID'] = ImportHandler::getInstance()->getNewID($this->objectTypeName, $data['parentCategoryID']); + + $action = new CategoryAction(array(), 'create', array( + 'data' => array_merge($data, array('objectTypeID' => $this->objectTypeID)) + )); + $returnValues = $action->executeAction(); + $newID = $returnValues['returnValues']->categoryID; + + ImportHandler::getInstance()->saveNewID($this->objectTypeName, $oldID, $newID); + + return $newID; + } +}