From: joshuaruesweg Date: Fri, 16 Apr 2021 10:38:56 +0000 (+0200) Subject: Fix requesting multiple times the UserStorage tables if no cache exists X-Git-Tag: 5.4.0_Alpha_1~12^2~12^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fcec0f82bd1807903b5dde1bfb4f4247e2485835;p=GitHub%2FWoltLab%2FWCF.git Fix requesting multiple times the UserStorage tables if no cache exists --- 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']];