<?php
namespace wcf\system\importer;
use wcf\data\user\object\watch\UserObjectWatchEditor;
+use wcf\system\database\DatabaseException
/**
* Imports watched objects.
$data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
if (!$data['userID']) return 0;
- $watch = UserObjectWatchEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID)));
+ try {
+ $watch = UserObjectWatchEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID)));
+ }
+ catch (DatabaseException $e) {
+ // 23000 = INTEGRITY CONSTRAINT VIOLATION a.k.a. duplicate key
+ if ($e->getCode() != 23000) {
+ throw $e;
+ }
+ }
+
return $watch->watchID;
}
}