/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
$data['objectID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation.message', $data['objectID']);
if (!$data['objectID']) return 0;
$attachmentID = parent::import($oldID, $data);
if ($attachmentID && $attachmentID != $oldID) {
// fix embedded attachments
- $message = new ConversationMessage($data['objectID']);
+ $messageObj = new ConversationMessage($data['objectID']);
- if (StringUtil::indexOfIgnoreCase($message->message, '[attach]'.$oldID.'[/attach]') !== false || StringUtil::indexOfIgnoreCase($message->message, '[attach='.$oldID.']') !== false) {
- $newMessage = StringUtil::replaceIgnoreCase('[attach]'.$oldID.'[/attach]', '[attach]'.$attachmentID.'[/attach]', $message->message);
- $newMessage = StringUtil::replaceIgnoreCase('[attach='.$oldID.']', '[attach='.$attachmentID.']', $newMessage);
-
- $editor = new ConversationMessageEditor($message);
+ if (($newMessage = $this->fixEmbeddedAttachments($messageObj->message, $oldID, $attachmentID)) !== false) {
+ $editor = new ConversationMessageEditor($messageObj);
$editor->update(array(
'message' => $newMessage
));
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
$data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
// check existing conversation
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
$data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
if (!$data['userID']) return 0;
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
$data['conversationID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation', $data['conversationID']);
if (!$data['conversationID']) return 0;
$data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
$data['conversationID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation', $data['conversationID']);
if (!$data['conversationID']) return 0;
$data['participantID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['participantID']);
));
// save labels
- if ($data['participantID'] && !empty($data['labelIDs'])) {
+ if ($data['participantID'] && !empty($additionalData['labelIDs'])) {
$sql = "INSERT IGNORE INTO wcf".WCF_N."_conversation_label_to_object
(labelID, conversationID)
VALUES (?, ?)";
$statement = WCF::getDB()->prepareStatement($sql);
- foreach ($data['labelIDs'] as $labelID) {
+ foreach ($additionalData['labelIDs'] as $labelID) {
$labelID = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation.label', $labelID);
if ($labelID) $statement->execute(array($labelID, $data['conversationID']));
}