mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Optimizing ChatRoom::getUsers()
This commit is contained in:
parent
f72dfb4e54
commit
f8193d1050
@ -135,7 +135,7 @@ public function getUsers() {
|
||||
$userIDs = array();
|
||||
while ($userIDs[] = $stmt->fetchColumn());
|
||||
|
||||
if (!count($userIDs)) return array();
|
||||
if (empty($userIDs)) return array();
|
||||
|
||||
$sql = "SELECT
|
||||
u.*,
|
||||
@ -150,12 +150,11 @@ public function getUsers() {
|
||||
AND s.packageID = ?
|
||||
)
|
||||
WHERE
|
||||
u.userID IN (".rtrim(str_repeat('?,', count($userIDs)), ',').")
|
||||
u.userID IN (?)
|
||||
ORDER BY
|
||||
u.username ASC";
|
||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||
array_unshift($userIDs, 'away', $packageID);
|
||||
$stmt->execute($userIDs);
|
||||
$stmt->execute(array('away', $packageID, $userIDs));
|
||||
|
||||
return $stmt->fetchObjects('\wcf\data\user\User');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user