From fcec0f82bd1807903b5dde1bfb4f4247e2485835 Mon Sep 17 00:00:00 2001 From: joshuaruesweg Date: Fri, 16 Apr 2021 12:38:56 +0200 Subject: [PATCH] Fix requesting multiple times the UserStorage tables if no cache exists --- .../lib/system/user/storage/UserStorageHandler.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php b/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php index 9ca9ffe257..5b23689100 100644 --- a/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php @@ -55,7 +55,10 @@ class UserStorageHandler extends SingletonFactory { $tmp = []; foreach ($userIDs as $userID) { - if (!isset($this->cache[$userID])) $tmp[] = $userID; + if (!isset($this->cache[$userID])) { + $tmp[] = $userID; + $this->cache[$userID] = []; + } } // ignore users whose storage data is already loaded @@ -70,10 +73,6 @@ class UserStorageHandler extends SingletonFactory { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); while ($row = $statement->fetchArray()) { - if (!isset($this->cache[$row['userID']])) { - $this->cache[$row['userID']] = []; - } - if (isset($this->log[$row['userID']])) { if (array_key_exists($row['field'], $this->log[$row['userID']])) { $logged = $this->log[$row['userID']][$row['field']]; -- 2.20.1