Commit | Line | Data |
---|---|---|
0ce25d96 MW |
1 | <?php |
2 | namespace wcf\system\importer; | |
3 | use wcf\data\conversation\Conversation; | |
4 | use wcf\data\conversation\ConversationEditor; | |
5 | ||
6 | /** | |
7 | * Imports conversations. | |
8 | * | |
9 | * @author Marcel Werk | |
10 | * @copyright 2001-2013 WoltLab GmbH | |
11 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | |
12 | * @package com.woltlab.wcf.conversation | |
13 | * @subpackage system.importer | |
14 | * @category Community Framework | |
15 | */ | |
16 | class ConversationImporter implements IImporter { | |
17 | /** | |
18 | * @see wcf\system\importer\IImporter::import() | |
19 | */ | |
6959edc2 | 20 | public function import($oldID, array $data, array $additionalData = array()) { |
0ce25d96 MW |
21 | $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']); |
22 | ||
23 | // check existing conversation | |
24 | $existingConversation = new Conversation($oldID); | |
25 | if (!$existingConversation->conversationID) $data['conversationID'] = $oldID; | |
26 | ||
27 | $conversation = ConversationEditor::create($data); | |
28 | ||
29 | ImportHandler::getInstance()->saveNewID('com.woltlab.wcf.conversation', $oldID, $conversation->conversationID); | |
30 | ||
31 | return $conversation->conversationID; | |
32 | } | |
33 | } |