From: Alexander Ebert Date: Tue, 1 Jul 2014 12:09:57 +0000 (+0200) Subject: Preventing an unnecessary query to fetch user profiles X-Git-Tag: 2.1.0_Alpha_1~641^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8c8e4eff88f11e98c9a0240047be8deb7d1c477f;p=GitHub%2FWoltLab%2FWCF.git Preventing an unnecessary query to fetch user profiles The user profile list attempts to read the object ids prior to reading the actual users which is a good idea if you're fetching users based upon multiple criteria. When reading user profiles by user id we already know the user ids and can directly pass them to avoid the query since the result is most likely the same. --- diff --git a/wcfsetup/install/files/lib/data/user/UserProfile.class.php b/wcfsetup/install/files/lib/data/user/UserProfile.class.php index 9f7824c5bb..187c5fa518 100644 --- a/wcfsetup/install/files/lib/data/user/UserProfile.class.php +++ b/wcfsetup/install/files/lib/data/user/UserProfile.class.php @@ -380,7 +380,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider if (!empty($userIDs)) { $userList = new UserProfileList(); - $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($userIDs)); + $userList->setObjectIDs($userIDs); $userList->readObjects(); foreach ($userList as $user) {