<?php
namespace wcf\system\importer;
use wcf\data\attachment\AttachmentEditor;
+use wcf\data\attachment\Attachment;
use wcf\system\exception\SystemException;
use wcf\util\StringUtil;
// get user id
$data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
+ // check existing attachment id
+ if (is_numeric($oldID)) {
+ $attachment = new Attachment($oldID);
+ if (!$attachment->attachmentID) $data['attachmentID'] = $oldID;
+ }
+
// save attachment
$attachment = AttachmentEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID)));