Use runtime cache instead of `UserProfile::getUserProfile()` (#3688)
authorMatthias Schmidt <gravatronics@live.com>
Mon, 21 Dec 2020 12:12:35 +0000 (13:12 +0100)
committerGitHub <noreply@github.com>
Mon, 21 Dec 2020 12:12:35 +0000 (13:12 +0100)
wcfsetup/install/files/lib/form/ModerationReportForm.class.php

index b1a10bdecafed7cab102c5dea394f8549efa06a2..2b26f210132be0b32271f1efe47f576e958b01b2 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\form;
 use wcf\data\user\User;
 use wcf\data\user\UserProfile;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\moderation\queue\report\IModerationQueueReportHandler;
 use wcf\system\moderation\queue\ModerationQueueManager;
@@ -35,8 +36,11 @@ class ModerationReportForm extends AbstractModerationForm {
        public function assignVariables() {
                parent::assignVariables();
                
-               $reportUser = UserProfile::getUserProfile($this->queue->userID);
-               if ($reportUser === null) $reportUser = new UserProfile(new User(null, []));
+               $reportUser = UserProfileRuntimeCache::getInstance()->getObject($this->queue->userID);
+               if ($reportUser === null) {
+                       $reportUser = new UserProfile(new User(null, []));
+               }
+               
                WCF::getTPL()->assign([
                        'reportedContent' => ModerationQueueReportManager::getInstance()->getReportedContent($this->queue),
                        'queueManager' => ModerationQueueReportManager::getInstance(),