From: Matthias Schmidt Date: Sun, 8 Sep 2019 17:24:47 +0000 (+0200) Subject: Add media category importer X-Git-Tag: 5.2.0_Beta_2~68 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7a938996a232e48dbb0da32f71963afe6da3a9e6;p=GitHub%2FWoltLab%2FWCF.git Add media category importer Close #3069 --- diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index fa07ea4b5b..8393c09d83 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -451,6 +451,11 @@ com.woltlab.wcf.importer wcf\system\importer\ArticleImporter + + com.woltlab.wcf.media.category + com.woltlab.wcf.importer + wcf\system\importer\MediaCategoryImporter + com.woltlab.wcf.media com.woltlab.wcf.importer diff --git a/wcfsetup/install/files/lib/system/importer/MediaCategoryImporter.class.php b/wcfsetup/install/files/lib/system/importer/MediaCategoryImporter.class.php new file mode 100644 index 0000000000..70f8a4631c --- /dev/null +++ b/wcfsetup/install/files/lib/system/importer/MediaCategoryImporter.class.php @@ -0,0 +1,28 @@ + + * @package WoltLabSuite\Core\System\Importer + */ +class MediaCategoryImporter extends AbstractCategoryImporter { + /** + * @inheritDoc + */ + protected $objectTypeName = 'com.woltlab.wcf.media.category'; + + /** + * Creates a new `MediaCategoryImporter` object. + */ + public function __construct() { + $this->objectTypeID = ObjectTypeCache::getInstance()->getObjectTypeByName( + 'com.woltlab.wcf.category', + 'com.woltlab.wcf.media.category' + )->objectTypeID; + } +} diff --git a/wcfsetup/install/files/lib/system/importer/MediaImporter.class.php b/wcfsetup/install/files/lib/system/importer/MediaImporter.class.php index bf32652ee8..b34514b44c 100644 --- a/wcfsetup/install/files/lib/system/importer/MediaImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/MediaImporter.class.php @@ -70,6 +70,15 @@ class MediaImporter extends AbstractImporter { if (!$media->mediaID) $data['mediaID'] = $oldID; } + // category + $categoryID = null; + if (!empty($data['categoryID'])) { + $categoryID = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.media.category', $data['categoryID']); + } + if ($categoryID !== null) { + $data['categoryID'] = $categoryID; + } + // save media $media = MediaEditor::create($data); diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index c7fd1c25b7..28ff5d69ab 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -382,6 +382,7 @@ + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index ed54fdc3b2..330a49bc20 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -358,6 +358,7 @@ +