/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
- $fileLocation = $data['fileLocation'];
- unset($data['fileLocation']);
-
+ public function import($oldID, array $data, array $additionalData = array()) {
// check file location
- if (!@file_exists($fileLocation)) return 0;
+ if (!@file_exists($additionalData['fileLocation'])) return 0;
// get file hash
- if (empty($data['fileHash'])) $data['fileHash'] = sha1_file($fileLocation);
+ if (empty($data['fileHash'])) $data['fileHash'] = sha1_file($additionalData['fileLocation']);
// get user id
if ($data['userID']) $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
// copy file
try {
- if (!copy($fileLocation, $attachment->getLocation())) {
+ if (!copy($additionalData['fileLocation'], $attachment->getLocation())) {
throw new SystemException();
}
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
if ($data['userID']) $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
$action = new CommentAction(array(), 'create', array(
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
if ($data['userID']) $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
$data['commentID'] = ImportHandler::getInstance()->getNewID($this->objectTypeName, $data['commentID']);
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
if ($data['objectUserID']) $data['objectUserID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['objectUserID']);
$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()) {
$poll = PollEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID)));
ImportHandler::getInstance()->saveNewID($this->objectTypeName, $oldID, $poll->pollID);
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
$data['pollID'] = ImportHandler::getInstance()->getNewID($this->pollObjectTypeName, $data['pollID']);
if (!$data['pollID']) return 0;
/**
* @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['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
if (!$data['userID']) return 0;
*
* @param mixed $oldID
* @param array $data
+ * @param array $additionalData
* @return mixed new id
*/
- public function import($oldID, array $data);
+ public function import($oldID, array $data, array $additionalData = array());
}
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
- $fileLocation = $data['fileLocation'];
- unset($data['fileLocation']);
-
+ public function import($oldID, array $data, array $additionalData = array()) {
// check file location
- if (!@file_exists($fileLocation)) return 0;
+ if (!@file_exists($additionalData['fileLocation'])) return 0;
// get image size
- $imageData = @getimagesize($fileLocation);
+ $imageData = @getimagesize($additionalData['fileLocation']);
if ($imageData === false) return 0;
$data['width'] = $imageData[0];
$data['height'] = $imageData[1];
if ($imageData[2] != IMAGETYPE_GIF && $imageData[2] != IMAGETYPE_JPEG && $imageData[2] != IMAGETYPE_PNG) return 0;
// get file hash
- if (empty($data['fileHash'])) $data['fileHash'] = sha1_file($fileLocation);
+ if (empty($data['fileHash'])) $data['fileHash'] = sha1_file($additionalData['fileLocation']);
// get user id
$data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
// copy file
try {
- if (!copy($fileLocation, $avatar->getLocation())) {
+ if (!copy($additionalData['fileLocation'], $avatar->getLocation())) {
throw new SystemException();
}
/**
* @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.user', $data['objectID']);
if (!$data['objectID']) return 0;
/**
* @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']);
$data['followUserID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['followUserID']);
if (!$data['userID'] || !$data['followUserID']) return 0;
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
$action = new UserGroupAction(array(), 'create', array(
'data' => $data
));
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
// check existing user id
$sql = "SELECT COUNT(*) AS count
FROM wcf".WCF_N."_user
// get group ids
$groupIDs = array();
- if (isset($data['groupIDs'])) {
- foreach ($data['groupIDs'] as $oldGroupID) {
+ if (isset($additionalData['groupIDs'])) {
+ foreach ($additionalData['groupIDs'] as $oldGroupID) {
$newGroupID = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user.group', $oldGroupID);
if ($newGroupID) $groupIDs[] = $newGroupID;
}
-
- unset($data['groupIDs']);
}
// handle user options
$userOptions = array();
- if (isset($data['options'])) {
- foreach ($data['options'] as $optionName => $optionValue) {
+ if (isset($additionalData['options'])) {
+ foreach ($additionalData['options'] as $optionName => $optionValue) {
if (is_int($optionName)) $optionID = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user.option', $optionName);
else $optionID = User::getUserOptionID($optionName);
$userOptions[$optionID] = $optionValue;
}
}
-
- unset($data['options']);
}
// create user
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
- $name = $data['name'];
- unset($data['name']);
+ public function import($oldID, array $data, array $additionalData = array()) {
$data['packageID'] = 1;
// save option
$statement->execute(array(
LanguageFactory::getInstance()->getDefaultLanguageID(),
'wcf.user.option.option'.$userOption->optionID,
- $name,
+ $additionalData,
0,
$this->languageCategoryID,
1
/**
* @see wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data) {
+ public function import($oldID, array $data, array $additionalData = array()) {
$data['groupID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user.group', $data['groupID']);
if (!$data['groupID']) $data['groupID'] = UserGroup::getGroupByType(UserGroup::USERS)->groupID;