From c4d8a5f93279c964007c4962d2c3f43f4f9ed514 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 28 Jul 2013 13:20:16 +0200 Subject: [PATCH] Ignore potential collisions if importing follower Under certain circumstances, the default inserts could fail if a user is being merged during the process and follows the same user as the merged user. --- .../importer/UserFollowerImporter.class.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php index f357d209ac..3aa714ae62 100644 --- a/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php @@ -1,6 +1,6 @@ getNewID('com.woltlab.wcf.user', $data['followUserID']); if (!$data['userID'] || !$data['followUserID']) return 0; - $action = new UserFollowAction(array(), 'create', array( - 'data' => $data + $sql = "INSERT IGNORE INTO wcf".WCF_N."_user_follow + (userID, followUserID, time) + VALUES (?, ?, ?)"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array( + $data['userID'], + $data['followUserID'], + $data['time'] )); - $returnValues = $action->executeAction(); - return $returnValues['returnValues']->followID; + + return WCF::getDB()->getInsertID('wcf'.WCF_N.'_user_follow', 'followID'); } } -- 2.20.1