From: joshuaruesweg Date: Mon, 11 Jan 2021 12:54:23 +0000 (+0100) Subject: Fix multiple queries for user online list stats X-Git-Tag: 5.3.3~29 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c48646d5bfc94ef7190dd5f1979d93865dbb51cb;p=GitHub%2FWoltLab%2FWCF.git Fix multiple queries for user online list stats --- diff --git a/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php b/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php index 3852d932a3..9aed41014b 100644 --- a/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php +++ b/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php @@ -99,21 +99,29 @@ class UsersOnlineList extends SessionList { ".$conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditionBuilder->getParameters()); + + $users = $userIDs = []; while ($row = $statement->fetchArray()) { - $user = new UserOnline(new User(null, $row)); - $this->stats['total']++; + + $user = new UserOnline(new User(null, $row)); if ($user->userID) { $this->stats['members']++; - - if ($user->canViewOnlineStatus && !self::isVisibleUser($user)) { - $this->stats['invisible']++; - } + $users[] = $user; + $userIDs[] = $user->userID; } else { $this->stats['guests']++; } } + + UserStorageHandler::getInstance()->loadStorage($userIDs); + + foreach ($users as $user) { + if ($user->canViewOnlineStatus && !self::isVisibleUser($user)) { + $this->stats['invisible']++; + } + } } /**