From 6f2c8e0eadf83b8bd8a348af5f544891c2563b51 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sun, 30 Jun 2013 20:36:27 +0200 Subject: [PATCH] Added more import features --- com.woltlab.wcf/objectType.xml | 4 +-- .../files/acp/templates/dataImport.tpl | 8 +++-- .../importer/UserFollowerImporter.class.php | 30 ++++++++++++++++ .../importer/UserRankImporter.class.php | 34 +++++++++++++++++++ wcfsetup/install/lang/de.xml | 23 +++++++++++++ wcfsetup/install/lang/en.xml | 23 +++++++++++++ 6 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php create mode 100644 wcfsetup/install/files/lib/system/importer/UserRankImporter.class.php diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index e122687a12..e45c17a049 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -241,7 +241,7 @@ com.woltlab.wcf.user.comment.response com.woltlab.wcf.importer - + --> com.woltlab.wcf.user.follower com.woltlab.wcf.importer @@ -251,7 +251,7 @@ com.woltlab.wcf.user.rank com.woltlab.wcf.importer - --> + \ No newline at end of file diff --git a/wcfsetup/install/files/acp/templates/dataImport.tpl b/wcfsetup/install/files/acp/templates/dataImport.tpl index 47d215fa95..204ebfa5bd 100644 --- a/wcfsetup/install/files/acp/templates/dataImport.tpl +++ b/wcfsetup/install/files/acp/templates/dataImport.tpl @@ -42,6 +42,9 @@

{lang}wcf.acp.dataImport{/lang}

+ {if $exporterName} +

{lang}wcf.acp.dataImport.exporter.{@$exporterName}{/lang}

+ {/if}
{if $errorField} @@ -121,11 +124,11 @@ {/foreach} -
+ {*
{lang}wcf.acp.dataImport.configure.settings{/lang} -
+
*}
{lang}wcf.acp.dataImport.configure.database{/lang} @@ -173,6 +176,7 @@
+ {lang}wcf.acp.dataImport.configure.fileSystem.path.description{/lang}
diff --git a/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php new file mode 100644 index 0000000000..626e06ee38 --- /dev/null +++ b/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php @@ -0,0 +1,30 @@ + + * @package com.woltlab.wcf + * @subpackage system.importer + * @category Community Framework + */ +class UserFollowerImporter implements IImporter { + /** + * @see wcf\system\importer::import() + */ + public function import($oldID, array $data) { + $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']); + $data['followUserID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['followUserID']); + if (!$data['userID'] || !$data['followUserID']) return 0; + + $action = new UserFollowAction(array(), 'create', array( + 'data' => $data + )); + $returnValues = $action->executeAction(); + return $returnValues['returnValues']->followID; + } +} diff --git a/wcfsetup/install/files/lib/system/importer/UserRankImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserRankImporter.class.php new file mode 100644 index 0000000000..f97b9f7934 --- /dev/null +++ b/wcfsetup/install/files/lib/system/importer/UserRankImporter.class.php @@ -0,0 +1,34 @@ + + * @package com.woltlab.wcf + * @subpackage system.importer + * @category Community Framework + */ +class UserRankImporter implements IImporter { + /** + * @see wcf\system\importer::import() + */ + public function import($oldID, array $data) { + $data['groupID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user.group', $data['groupID']); + if (!$data['groupID']) $data['groupID'] = UserGroup::getGroupByType(UserGroup::USERS)->groupID; + + $action = new UserRankAction(array(), 'create', array( + 'data' => $data + )); + $returnValues = $action->executeAction(); + $newID = $returnValues['returnValues']->rankID; + + ImportHandler::getInstance()->saveNewID('com.woltlab.wcf.user.rank', $oldID, $newID); + + return $newID; + } +} diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 4598dd12be..e68708797c 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -162,6 +162,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -493,6 +515,7 @@ + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index d6098eb392..24fea6185e 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -161,6 +161,28 @@ Examples for medium ID detection: + + + + + + + + + + + + + + + + + + + + + + @@ -492,6 +514,7 @@ Examples for medium ID detection: + -- 2.20.1