Add runtime cache API
authorMatthias Schmidt <gravatronics@live.com>
Sat, 26 Mar 2016 16:25:52 +0000 (17:25 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 26 Mar 2016 16:25:52 +0000 (17:25 +0100)
36 files changed:
wcfsetup/install/files/lib/data/comment/StructuredComment.class.php
wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php
wcfsetup/install/files/lib/data/comment/ViewableComment.class.php
wcfsetup/install/files/lib/data/comment/ViewableCommentList.class.php
wcfsetup/install/files/lib/data/comment/response/StructuredCommentResponse.class.php
wcfsetup/install/files/lib/data/comment/response/StructuredCommentResponseList.class.php
wcfsetup/install/files/lib/data/comment/response/ViewableCommentResponse.class.php
wcfsetup/install/files/lib/data/comment/response/ViewableCommentResponseList.class.php
wcfsetup/install/files/lib/data/like/ViewableLike.class.php
wcfsetup/install/files/lib/data/like/ViewableLikeList.class.php
wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueue.class.php
wcfsetup/install/files/lib/data/moderation/queue/ViewableModerationQueueList.class.php
wcfsetup/install/files/lib/data/user/UserProfile.class.php
wcfsetup/install/files/lib/data/user/UserProfileCache.class.php
wcfsetup/install/files/lib/data/user/activity/event/ViewableUserActivityEvent.class.php
wcfsetup/install/files/lib/data/user/activity/event/ViewableUserActivityEventList.class.php
wcfsetup/install/files/lib/system/cache/runtime/AbstractRuntimeCache.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/runtime/CommentRuntimeCache.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/runtime/IRuntimeCache.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/runtime/UserProfileRuntimeCache.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/comment/CommentDataHandler.class.php
wcfsetup/install/files/lib/system/dashboard/box/MostActiveMembersDashboardBox.class.php
wcfsetup/install/files/lib/system/dashboard/box/MostLikedMembersDashboardBox.class.php
wcfsetup/install/files/lib/system/dashboard/box/NewestMembersDashboardBox.class.php
wcfsetup/install/files/lib/system/dashboard/box/TodaysBirthdaysDashboardBox.class.php
wcfsetup/install/files/lib/system/dashboard/box/TodaysFollowingBirthdaysDashboardBox.class.php
wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeWoltlabMention.class.php
wcfsetup/install/files/lib/system/message/embedded/object/QuoteMessageEmbeddedObjectHandler.class.php
wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentResponseUserActivityEvent.class.php
wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php
wcfsetup/install/files/lib/system/user/notification/event/ModerationQueueCommentResponseUserNotificationEvent.class.php
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentLikeUserNotificationEvent.class.php
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseLikeUserNotificationEvent.class.php
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseOwnerUserNotificationEvent.class.php
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseUserNotificationEvent.class.php
wcfsetup/install/files/lib/system/user/notification/object/type/TMultiRecipientModerationQueueCommentUserNotificationObjectType.class.php

index 1aca1fd78921501e8db48bcaf62af0f9098a74c1..544b43a4a667e6e19b92b749225a434960edcd6d 100644 (file)
@@ -3,14 +3,14 @@ namespace wcf\data\comment;
 use wcf\data\comment\response\StructuredCommentResponse;
 use wcf\data\user\User;
 use wcf\data\user\UserProfile;
-use wcf\data\user\UserProfileCache;
 use wcf\data\DatabaseObjectDecorator;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 
 /**
  * Provides methods to handle responses for this comment.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.comment
@@ -18,15 +18,15 @@ use wcf\data\DatabaseObjectDecorator;
  */
 class StructuredComment extends DatabaseObjectDecorator implements \Countable, \Iterator {
        /**
-        * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+        * @inheritDoc
         */
-       public static $baseClass = 'wcf\data\comment\Comment';
+       public static $baseClass = Comment::class;
        
        /**
         * list of ordered responses
-        * @var array<\wcf\data\comment\response\StructuredCommentResponse>
+        * @var StructuredCommentResponse[]
         */
-       protected $responses = array();
+       protected $responses = [];
        
        /**
         * deletable by current user
@@ -47,15 +47,15 @@ class StructuredComment extends DatabaseObjectDecorator implements \Countable, \
        private $position = 0;
        
        /**
-        * user profile object
-        * @var \wcf\data\user\UserProfile
+        * user profile object of the comment author
+        * @var UserProfile
         */
        public $userProfile = null;
        
        /**
         * Adds an response
         * 
-        * @param       \wcf\data\comment\response\StructuredCommentResponse    $response
+        * @param       StructuredCommentResponse       $response
         */
        public function addResponse(StructuredCommentResponse $response) {
                $this->responses[] = $response;
@@ -64,7 +64,7 @@ class StructuredComment extends DatabaseObjectDecorator implements \Countable, \
        /**
         * Returns the last responses for this comment.
         * 
-        * @return      array<\wcf\data\comment\response\StructuredCommentResponse>
+        * @return      StructuredCommentResponse[]
         */
        public function getResponses() {
                return $this->responses;
@@ -91,7 +91,7 @@ class StructuredComment extends DatabaseObjectDecorator implements \Countable, \
        /**
         * Sets the user's profile.
         * 
-        * @param       \wcf\data\user\UserProfile      $userProfile
+        * @param       UserProfile     $userProfile
         */
        public function setUserProfile(UserProfile $userProfile) {
                $this->userProfile = $userProfile;
@@ -100,17 +100,17 @@ class StructuredComment extends DatabaseObjectDecorator implements \Countable, \
        /**
         * Returns the user's profile.
         * 
-        * @return      \wcf\data\user\UserProfile
+        * @return      UserProfile
         */
        public function getUserProfile() {
                if ($this->userProfile === null) {
                        if ($this->userID) {
-                               $this->userProfile = UserProfileCache::getInstance()->getUserProfile($this->userID);
+                               $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->userID);
                        }
                        else {
-                               $this->userProfile = new UserProfile(new User(null, array(
+                               $this->userProfile = new UserProfile(new User(null, [
                                        'username' => $this->username
-                               )));
+                               ]));
                        }
                }
                
index a78d9f6beb15fb9a38ec54bb3b832543d7fd6e21..8992261021741e38c148f479b9d4d866d279fd04 100644 (file)
@@ -2,7 +2,8 @@
 namespace wcf\data\comment;
 use wcf\data\comment\response\CommentResponseList;
 use wcf\data\comment\response\StructuredCommentResponse;
-use wcf\data\user\UserProfileCache;
+use wcf\data\like\object\LikeObject;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\comment\manager\ICommentManager;
 use wcf\system\like\LikeHandler;
 
@@ -10,7 +11,7 @@ use wcf\system\like\LikeHandler;
  * Provides a structured comment list fetching last responses for every comment.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.comment
@@ -19,7 +20,7 @@ use wcf\system\like\LikeHandler;
 class StructuredCommentList extends CommentList {
        /**
         * comment manager object
-        * @var \wcf\system\comment\manager\ICommentManager
+        * @var ICommentManager
         */
        public $commentManager = null;
        
@@ -43,31 +44,31 @@ class StructuredCommentList extends CommentList {
        
        /**
         * ids of the responses of the comments in the list
-        * @var array<integer>
+        * @var integer[]
         */
-       public $responseIDs = array();
+       public $responseIDs = [];
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$decoratorClassName
+        * @inheritDoc
         */
        public $decoratorClassName = StructuredComment::class;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$sqlLimit
+        * @inheritDoc
         */
        public $sqlLimit = 30;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$sqlOrderBy
+        * @inheritDoc
         */
        public $sqlOrderBy = 'comment.time DESC';
        
        /**
         * Creates a new structured comment list.
         * 
-        * @param       \wcf\system\comment\manager\ICommentManager     $commentManager
-        * @param       integer                                         $objectTypeID
-        * @param       integer                                         $objectID
+        * @param       ICommentManager         $commentManager
+        * @param       integer                 $objectTypeID
+        * @param       integer                 $objectID
         */
        public function __construct(ICommentManager $commentManager, $objectTypeID, $objectID) {
                parent::__construct();
@@ -76,19 +77,19 @@ class StructuredCommentList extends CommentList {
                $this->objectTypeID = $objectTypeID;
                $this->objectID = $objectID;
                
-               $this->getConditionBuilder()->add("comment.objectTypeID = ?", array($objectTypeID));
-               $this->getConditionBuilder()->add("comment.objectID = ?", array($objectID));
+               $this->getConditionBuilder()->add("comment.objectTypeID = ?", [$objectTypeID]);
+               $this->getConditionBuilder()->add("comment.objectID = ?", [$objectID]);
                $this->sqlLimit = $this->commentManager->getCommentsPerPage();
        }
        
        /**
-        * @see \wcf\data\DatabaseObjectList::readObjects()
+        * @inheritDoc
         */
        public function readObjects() {
                parent::readObjects();
                
                // fetch response ids
-               $responseIDs = $userIDs = array();
+               $responseIDs = $userIDs = [];
                foreach ($this->objects as $comment) {
                        if (!$this->minCommentTime || $comment->time < $this->minCommentTime) $this->minCommentTime = $comment->time;
                        $commentResponseIDs = $comment->getResponseIDs();
@@ -127,19 +128,19 @@ class StructuredCommentList extends CommentList {
                
                // cache user ids
                if (!empty($userIDs)) {
-                       UserProfileCache::getInstance()->cacheUserIDs(array_unique($userIDs));
+                       UserProfileRuntimeCache::getInstance()->cacheObjectIDs(array_unique($userIDs));
                }
        }
        
        /**
         * Fetches the like data.
         * 
-        * @return      array
+        * @return      LikeObject[][]
         */
        public function getLikeData() {
-               if (empty($this->objectIDs)) return array();
+               if (empty($this->objectIDs)) return [];
                
-               $likeData = array();
+               $likeData = [];
                $commentObjectType = LikeHandler::getInstance()->getObjectType('com.woltlab.wcf.comment');
                LikeHandler::getInstance()->loadLikeObjects($commentObjectType, $this->getObjectIDs());
                $likeData['comment'] = LikeHandler::getInstance()->getLikeObjects($commentObjectType);
@@ -165,7 +166,7 @@ class StructuredCommentList extends CommentList {
        /**
         * Returns the comment manager object.
         * 
-        * @return      \wcf\system\comment\manager\ICommentManager
+        * @return      ICommentManager
         */
        public function getCommentManager() {
                return $this->commentManager;
index f505207ce8a299dc52e9839f6c14e4ef44ea02e0..34d749556be028ff854496018e0f50b18a3ab01b 100644 (file)
@@ -2,15 +2,15 @@
 namespace wcf\data\comment;
 use wcf\data\user\User;
 use wcf\data\user\UserProfile;
-use wcf\data\user\UserProfileCache;
 use wcf\data\DatabaseObjectDecorator;
 use wcf\data\TLegacyUserPropertyAccess;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 
 /**
  * Represents a viewable comment.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.comment
@@ -20,30 +20,30 @@ class ViewableComment extends DatabaseObjectDecorator {
        use TLegacyUserPropertyAccess;
        
        /**
-        * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+        * @inheritDoc
         */
-       protected static $baseClass = 'wcf\data\comment\Comment';
+       protected static $baseClass = Comment::class;
        
        /**
-        * user profile object
-        * @var \wcf\data\user\UserProfile
+        * user profile of the comment author
+        * @var UserProfile
         */
        protected $userProfile = null;
        
        /**
         * Returns the user profile object.
         * 
-        * @return      \wcf\data\user\UserProfile
+        * @return      UserProfile
         */
        public function getUserProfile() {
                if ($this->userProfile === null) {
                        if ($this->userID) {
-                               $this->userProfile = UserProfileCache::getInstance()->getUserProfile($this->userID);
+                               $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->userID);
                        }
                        else {
-                               $this->userProfile = new UserProfile(new User(null, array(
+                               $this->userProfile = new UserProfile(new User(null, [
                                        'username' => $this->username
-                               )));
+                               ]));
                        }
                }
                
@@ -51,14 +51,14 @@ class ViewableComment extends DatabaseObjectDecorator {
        }
        
        /**
-        * Gets a specific comment decorated as comment entry.
+        * Returns a specific comment decorated as comment entry.
         * 
         * @param       integer         $commentID
-        * @return      \wcf\data\comment\ViewableComment
+        * @return      ViewableComment
         */
        public static function getComment($commentID) {
                $list = new ViewableCommentList();
-               $list->setObjectIDs(array($commentID));
+               $list->setObjectIDs([$commentID]);
                $list->readObjects();
                $objects = $list->getObjects();
                if (isset($objects[$commentID])) return $objects[$commentID];
index 89b8db4c54bb890951e1470fea38c395b838936b..e2ab16f0b88f43bf6d9884bcdfa160cc457ba4ff 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 namespace wcf\data\comment;
-use wcf\data\user\UserProfileCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 
 /**
  * Represents a list of decorated comment objects.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.comment
@@ -14,15 +14,18 @@ use wcf\data\user\UserProfileCache;
  */
 class ViewableCommentList extends CommentList {
        /**
-        * @see \wcf\data\DatabaseObjectList::$decoratorClassName
+        * @inheritDoc
         */
-       public $decoratorClassName = 'wcf\data\comment\ViewableComment';
+       public $decoratorClassName = ViewableComment::class;
        
+       /**
+        * @inheritDoc
+        */
        public function readObjects() {
                parent::readObjects();
                
                if (!empty($this->objects)) {
-                       $userIDs = array();
+                       $userIDs = [];
                        foreach ($this->objects as $comment) {
                                if ($comment->userID) {
                                        $userIDs[] = $comment->userID;
@@ -30,7 +33,7 @@ class ViewableCommentList extends CommentList {
                        }
                        
                        if (!empty($userIDs)) {
-                               UserProfileCache::getInstance()->cacheUserIDs($userIDs);
+                               UserProfileRuntimeCache::getInstance()->cacheObjectIDs($userIDs);
                        }
                }
        }
index 9ead82e6fb3eaf63bb475ca73b698eeb5382655d..b4eef2f3bbf4071ff287ff21649448de65ae03ca 100644 (file)
@@ -2,14 +2,14 @@
 namespace wcf\data\comment\response;
 use wcf\data\user\User;
 use wcf\data\user\UserProfile;
-use wcf\data\user\UserProfileCache;
 use wcf\data\DatabaseObjectDecorator;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 
 /**
  * Provides methods to handle response data.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.comment.response
@@ -17,9 +17,9 @@ use wcf\data\DatabaseObjectDecorator;
  */
 class StructuredCommentResponse extends DatabaseObjectDecorator {
        /**
-        * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+        * @inheritDoc
         */
-       public static $baseClass = 'wcf\data\comment\response\CommentResponse';
+       public static $baseClass = CommentResponse::class;
        
        /**
         * deletable by current user
@@ -34,15 +34,15 @@ class StructuredCommentResponse extends DatabaseObjectDecorator {
        public $editable = false;
        
        /**
-        * user profile object
-        * @var \wcf\data\user\UserProfile
+        * user profile of the comment response author
+        * @var UserProfile
         */
        public $userProfile = null;
        
        /**
         * Sets the user's profile.
         * 
-        * @param       \wcf\data\user\UserProfile      $userProfile
+        * @param       UserProfile     $userProfile
         */
        public function setUserProfile(UserProfile $userProfile) {
                $this->userProfile = $userProfile;
@@ -51,12 +51,12 @@ class StructuredCommentResponse extends DatabaseObjectDecorator {
        /**
         * Returns the user's profile.
         * 
-        * @return      \wcf\data\user\UserProfile
+        * @return      UserProfile
         */
        public function getUserProfile() {
                if ($this->userProfile === null) {
                        if ($this->userID) {
-                               $this->userProfile = UserProfileCache::getInstance()->getUserProfile($this->userID);
+                               $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->userID);
                        }
                        else {
                                $this->userProfile = new UserProfile(new User(null, array(
@@ -72,7 +72,7 @@ class StructuredCommentResponse extends DatabaseObjectDecorator {
         * Returns a structured response.
         * 
         * @param       integer         $responseID
-        * @return      \wcf\data\comment\response\StructuredCommentResponse
+        * @return      StructuredCommentResponse
         */
        public static function getResponse($responseID) {
                $response = new CommentResponse($responseID);
@@ -85,7 +85,7 @@ class StructuredCommentResponse extends DatabaseObjectDecorator {
                
                // cache user profile
                if ($response->userID) {
-                       UserProfileCache::getInstance()->cacheUserID($response->userID);
+                       UserProfileRuntimeCache::getInstance()->cacheObjectID($response->userID);
                }
                
                return $response;
index 67e02014bdb13eede4bcb8f9ff6103b550a1455f..5055f02073df9e69ad9de075d7a8127b991191ed 100644 (file)
@@ -1,7 +1,8 @@
 <?php
 namespace wcf\data\comment\response;
 use wcf\data\comment\Comment;
-use wcf\data\user\UserProfileCache;
+use wcf\data\like\object\LikeObject;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\comment\manager\ICommentManager;
 use wcf\system\like\LikeHandler;
 
@@ -9,7 +10,7 @@ use wcf\system\like\LikeHandler;
  * Provides a structured comment response list.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.comment.response
@@ -18,13 +19,13 @@ use wcf\system\like\LikeHandler;
 class StructuredCommentResponseList extends CommentResponseList {
        /**
         * comment object
-        * @var \wcf\data\comment\Comment;
+        * @var Comment;
         */
        public $comment = null;
        
        /**
         * comment manager
-        * @var \wcf\system\comment\manager\ICommentManager
+        * @var ICommentManager
         */
        public $commentManager = null;
        
@@ -35,20 +36,20 @@ class StructuredCommentResponseList extends CommentResponseList {
        public $minResponseTime = 0;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$decoratorClassName
+        * @inheritDoc
         */
        public $decoratorClassName = StructuredCommentResponse::class;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$sqlLimit
+        * @inheritDoc
         */
        public $sqlLimit = 50;
        
        /**
         * Creates a new structured comment response list.
         * 
-        * @param       \wcf\system\comment\manager\ICommentManager     $commentManager
-        * @param       \wcf\data\comment\Comment                       $comment
+        * @param       ICommentManager         $commentManager
+        * @param       Comment                 $comment
         */
        public function __construct(ICommentManager $commentManager, Comment $comment) {
                parent::__construct();
@@ -56,18 +57,18 @@ class StructuredCommentResponseList extends CommentResponseList {
                $this->comment = $comment;
                $this->commentManager = $commentManager;
                
-               $this->getConditionBuilder()->add("comment_response.commentID = ?", array($this->comment->commentID));
+               $this->getConditionBuilder()->add("comment_response.commentID = ?", [$this->comment->commentID]);
                $this->sqlLimit = $this->commentManager->getCommentsPerPage();
        }
        
        /**
-        * @see \wcf\data\DatabaseObjectList::readObjects()
+        * @inheritDoc
         */
        public function readObjects() {
                parent::readObjects();
                
                // get user ids
-               $userIDs = array();
+               $userIDs = [];
                foreach ($this->objects as $response) {
                        if (!$this->minResponseTime || $response->time < $this->minResponseTime) $this->minResponseTime = $response->time;
                        $userIDs[] = $response->userID;
@@ -78,21 +79,21 @@ class StructuredCommentResponseList extends CommentResponseList {
                
                // cache user ids
                if (!empty($userIDs)) {
-                       UserProfileCache::getInstance()->cacheUserIDs(array_unique($userIDs));
+                       UserProfileRuntimeCache::getInstance()->cacheObjectIDs(array_unique($userIDs));
                }
        }
        
        /**
         * Fetches the like data.
         * 
-        * @return      array
+        * @return      LikeObject[][]
         */
        public function getLikeData() {
-               if (empty($this->objectIDs)) return array();
+               if (empty($this->objectIDs)) return [];
                
                $objectType = LikeHandler::getInstance()->getObjectType('com.woltlab.wcf.comment.response');
                LikeHandler::getInstance()->loadLikeObjects($objectType, $this->objectIDs);
-               $likeData = array('response' => LikeHandler::getInstance()->getLikeObjects($objectType));
+               $likeData = ['response' => LikeHandler::getInstance()->getLikeObjects($objectType)];
                
                return $likeData;
        }
index 63c88d99cc7f4858ad6d03e29533cc3135138a41..507cabfaf30a26d88757ad7ddcbb9f9098bf9a98 100644 (file)
@@ -2,15 +2,15 @@
 namespace wcf\data\comment\response;
 use wcf\data\user\User;
 use wcf\data\user\UserProfile;
-use wcf\data\user\UserProfileCache;
 use wcf\data\DatabaseObjectDecorator;
 use wcf\data\TLegacyUserPropertyAccess;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 
 /**
  * Represents a viewable comment response.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.comment.response
@@ -20,30 +20,30 @@ class ViewableCommentResponse extends DatabaseObjectDecorator {
        use TLegacyUserPropertyAccess;
        
        /**
-        * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+        * @inheritDoc
         */
-       protected static $baseClass = 'wcf\data\comment\response\CommentResponse';
+       protected static $baseClass = CommentResponse::class;
        
        /**
-        * user profile object
-        * @var \wcf\data\user\UserProfile
+        * user profile of the comment author
+        * @var UserProfile
         */
        protected $userProfile = null;
        
        /**
         * Returns the user profile object.
         * 
-        * @return      \wcf\data\user\UserProfile
+        * @return      UserProfile
         */
        public function getUserProfile() {
                if ($this->userProfile === null) {
                        if ($this->userID) {
-                               $this->userProfile = UserProfileCache::getInstance()->getUserProfile($this->userID);
+                               $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->userID);
                        }
                        else {
-                               $this->userProfile = new UserProfile(new User(null, array(
+                               $this->userProfile = new UserProfile(new User(null, [
                                        'username' => $this->username
-                               )));
+                               ]));
                        }
                }
                
@@ -51,14 +51,14 @@ class ViewableCommentResponse extends DatabaseObjectDecorator {
        }
        
        /**
-        * Gets a specific comment response decorated as viewable comment response.
+        * Returns a specific comment response decorated as viewable comment response.
         * 
         * @param       integer         $responseID
-        * @return      \wcf\data\comment\response\ViewableCommentResponse
+        * @return      ViewableCommentResponse
         */
        public static function getResponse($responseID) {
                $list = new ViewableCommentResponseList();
-               $list->setObjectIDs(array($responseID));
+               $list->setObjectIDs([$responseID]);
                $list->readObjects();
                $objects = $list->getObjects();
                if (isset($objects[$responseID])) return $objects[$responseID];
index 97b9f8454886a4fbf7713ce4c9945d72862700f1..dd33c9e21676b5fc2538946c41994df5dbf2cde8 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 namespace wcf\data\comment\response;
-use wcf\data\user\UserProfileCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 
 /**
  * Represents a list of decorated comment response objects.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.comment.response
@@ -14,15 +14,18 @@ use wcf\data\user\UserProfileCache;
  */
 class ViewableCommentResponseList extends CommentResponseList {
        /**
-        * @see \wcf\data\DatabaseObjectList::$decoratorClassName
+        * @inheritDoc
         */
-       public $decoratorClassName = 'wcf\data\comment\response\ViewableCommentResponse';
+       public $decoratorClassName = ViewableCommentResponse::class;
        
+       /**
+        * @inheritDoc
+        */
        public function readObjects() {
                parent::readObjects();
                
                if (!empty($this->objects)) {
-                       $userIDs = array();
+                       $userIDs = [];
                        foreach ($this->objects as $response) {
                                if ($response->userID) {
                                        $userIDs[] = $response->userID;
@@ -30,7 +33,7 @@ class ViewableCommentResponseList extends CommentResponseList {
                        }
                        
                        if (!empty($userIDs)) {
-                               UserProfileCache::getInstance()->cacheUserIDs($userIDs);
+                               UserProfileRuntimeCache::getInstance()->cacheObjectIDs($userIDs);
                        }
                }
        }
index 4c860373d0a7ae097cfd9cedbef7577752534b4c..c61d66295f7382958e1bf2f99b303dc6f2772215 100644 (file)
@@ -2,14 +2,14 @@
 namespace wcf\data\like;
 use wcf\data\object\type\ObjectTypeCache;
 use wcf\data\user\UserProfile;
-use wcf\data\user\UserProfileCache;
 use wcf\data\DatabaseObjectDecorator;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 
 /**
  * Provides methods for viewable likes.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.like
@@ -17,9 +17,9 @@ use wcf\data\DatabaseObjectDecorator;
  */
 class ViewableLike extends DatabaseObjectDecorator {
        /**
-        * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+        * @inheritDoc
         */
-       public static $baseClass = 'wcf\data\like\Like';
+       public static $baseClass = Like::class;
        
        /**
         * event text
@@ -41,7 +41,7 @@ class ViewableLike extends DatabaseObjectDecorator {
        
        /**
         * user profile
-        * @var \wcf\data\user\UserProfile
+        * @var UserProfile
         */
        protected $userProfile = null;
        
@@ -64,7 +64,7 @@ class ViewableLike extends DatabaseObjectDecorator {
        /**
         * Sets user profile.
         * 
-        * @param       \wcf\data\user\UserProfile      $userProfile
+        * @param       UserProfile     $userProfile
         */
        public function setUserProfile(UserProfile $userProfile) {
                $this->userProfile = $userProfile;
@@ -73,11 +73,11 @@ class ViewableLike extends DatabaseObjectDecorator {
        /**
         * Returns user profile.
         * 
-        * @return      \wcf\data\user\UserProfile
+        * @return      UserProfile
         */
        public function getUserProfile() {
                if ($this->userProfile === null) {
-                       $this->userProfile = UserProfileCache::getInstance()->getUserProfile($this->userID);
+                       $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->userID);
                }
                
                return $this->userProfile;
index 21e15489e96dcc542ef7d5efe93e4ad4f1deeb8b..0753fdba1caceec6a6d9f57b0fe7fec33d846dcc 100644 (file)
@@ -1,14 +1,14 @@
 <?php
 namespace wcf\data\like;
 use wcf\data\object\type\ObjectTypeCache;
-use wcf\data\user\UserProfileCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\like\IViewableLikeProvider;
 
 /**
  * Represents a list of viewable likes.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.like
@@ -16,27 +16,27 @@ use wcf\system\like\IViewableLikeProvider;
  */
 class ViewableLikeList extends LikeList {
        /**
-        * @see \wcf\data\DatabaseObjectList::$className
+        * @inheritDoc
         */
-       public $className = 'wcf\data\like\Like';
+       public $className = Like::class;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$decoratorClassName
+        * @inheritDoc
         */
        public $decoratorClassName = ViewableLike::class;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$sqlLimit
+        * @inheritDoc
         */
        public $sqlLimit = 20;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$sqlOrderBy
+        * @inheritDoc
         */
        public $sqlOrderBy = 'like_table.time DESC';
        
        /**
-        * @see \wcf\data\DatabaseObjectList::readObjects()
+        * @inheritDoc
         */
        public function readObjects() {
                parent::readObjects();
@@ -59,7 +59,7 @@ class ViewableLikeList extends LikeList {
                
                // set user profiles
                if (!empty($userIDs)) {
-                       UserProfileCache::getInstance()->cacheUserIDs(array_unique($userIDs));
+                       UserProfileRuntimeCache::getInstance()->cacheObjectIDs(array_unique($userIDs));
                }
                
                // parse like
index c0bc60e43273797a2cb965788dc3cdf86d7d7568..f126ea98faaa94420cdf918aeca3f4bf199140c8 100644 (file)
@@ -3,12 +3,12 @@ namespace wcf\data\moderation\queue;
 use wcf\data\object\type\ObjectTypeCache;
 use wcf\data\user\User;
 use wcf\data\user\UserProfile;
-use wcf\data\user\UserProfileCache;
 use wcf\data\DatabaseObjectDecorator;
 use wcf\data\ILinkableObject;
 use wcf\data\ITitledObject;
 use wcf\data\IUserContent;
 use wcf\system\bbcode\SimpleMessageParser;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\moderation\queue\ModerationQueueManager;
 use wcf\system\visitTracker\VisitTracker;
 
@@ -16,7 +16,7 @@ use wcf\system\visitTracker\VisitTracker;
  * Represents a viewable moderation queue entry.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.moderation.queue
@@ -97,7 +97,7 @@ class ViewableModerationQueue extends DatabaseObjectDecorator implements ILinkab
        public function getUserProfile() {
                if ($this->affectedObject !== null && $this->userProfile === null) {
                        if ($this->affectedObject->getUserID()) {
-                               $this->userProfile = UserProfileCache::getInstance()->getUserProfile($this->affectedObject->getUserID());
+                               $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->affectedObject->getUserID());
                        }
                        else {
                                $this->userProfile = new UserProfile(new User(null, []));
index 7c6d6556a14dc373de5ba0819b14684d137e89b1..ca0bd84aea88bb5788024e170279ecc67cfbec02 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 namespace wcf\data\moderation\queue;
-use wcf\data\user\UserProfileCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\moderation\queue\ModerationQueueManager;
 use wcf\system\WCF;
 
@@ -12,7 +12,7 @@ use wcf\system\WCF;
  *         would not work (MySQL is retarded).
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.moderation.queue
@@ -26,17 +26,17 @@ class ViewableModerationQueueList extends ModerationQueueList {
        public $loadUserProfiles = false;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$decoratorClassName
+        * @inheritDoc
         */
        public $decoratorClassName = ViewableModerationQueue::class;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$useQualifiedShorthand
+        * @inheritDoc
         */
        public $useQualifiedShorthand = false;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::__construct()
+        * @inheritDoc
         */
        public function __construct() {
                parent::__construct();
@@ -47,21 +47,21 @@ class ViewableModerationQueueList extends ModerationQueueList {
                $this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user assigned_user ON (assigned_user.userID = moderation_queue.assignedUserID)";
                $this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user user_table ON (user_table.userID = moderation_queue.userID)";
                $this->getConditionBuilder()->add("moderation_queue_to_user.queueID = moderation_queue.queueID");
-               $this->getConditionBuilder()->add("moderation_queue_to_user.userID = ?", array(WCF::getUser()->userID));
-               $this->getConditionBuilder()->add("moderation_queue_to_user.isAffected = ?", array(1));
+               $this->getConditionBuilder()->add("moderation_queue_to_user.userID = ?", [WCF::getUser()->userID]);
+               $this->getConditionBuilder()->add("moderation_queue_to_user.isAffected = ?", [1]);
        }
        
        /**
-        * @see \wcf\data\DatabaseObjectList::readObjects()
+        * @inheritDoc
         */
        public function readObjects() {
                parent::readObjects();
                
                if (!empty($this->objects)) {
-                       $objects = array();
+                       $objects = [];
                        foreach ($this->objects as &$object) {
                                if (!isset($objects[$object->objectTypeID])) {
-                                       $objects[$object->objectTypeID] = array();
+                                       $objects[$object->objectTypeID] = [];
                                }
                                
                                $objects[$object->objectTypeID][] = $object;
@@ -72,7 +72,7 @@ class ViewableModerationQueueList extends ModerationQueueList {
                        }
                        
                        // check for non-existant items
-                       $queueIDs = array();
+                       $queueIDs = [];
                        foreach ($this->objects as $index => $object) {
                                if ($object->isOrphaned()) {
                                        $queueIDs[] = $object->queueID;
@@ -88,12 +88,12 @@ class ViewableModerationQueueList extends ModerationQueueList {
                        }
                        
                        if ($this->loadUserProfiles) {
-                               $userIDs = array();
+                               $userIDs = [];
                                foreach ($this->objects as $object) {
                                        $userIDs[] = $object->getAffectedObject()->getUserID();
                                }
                                
-                               UserProfileCache::getInstance()->cacheUserIDs(array_unique($userIDs));
+                               UserProfileRuntimeCache::getInstance()->cacheObjectIDs(array_unique($userIDs));
                        }
                }
        }
index aa2129da4e6bd1f06a4d383c8039d7433b0a02a9..68efae21489d5238ad8da30eaf79006f7822e1de 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\data\user;
 use wcf\data\user\avatar\DefaultAvatar;
 use wcf\data\user\avatar\Gravatar;
+use wcf\data\user\avatar\IUserAvatar;
 use wcf\data\user\avatar\UserAvatar;
 use wcf\data\user\group\UserGroup;
 use wcf\data\user\online\UserOnline;
@@ -11,6 +12,7 @@ use wcf\data\DatabaseObjectDecorator;
 use wcf\system\breadcrumb\Breadcrumb;
 use wcf\system\breadcrumb\IBreadcrumbProvider;
 use wcf\system\cache\builder\UserGroupPermissionCacheBuilder;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\request\LinkHandler;
 use wcf\system\user\online\location\UserOnlineLocationHandler;
 use wcf\system\user\signature\SignatureCache;
@@ -23,7 +25,7 @@ use wcf\util\StringUtil;
  * Decorates the user object and provides functions to retrieve data for user profiles.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.user
@@ -31,43 +33,43 @@ use wcf\util\StringUtil;
  */
 class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider {
        /**
-        * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+        * @inheritDoc
         */
-       protected static $baseClass = 'wcf\data\user\User';
+       protected static $baseClass = User::class;
        
        /**
         * cached list of user profiles
-        * @var array<\wcf\data\user\UserProfile>
+        * @var UserProfile[]
         */
-       protected static $userProfiles = array();
+       protected static $userProfiles = [];
        
        /**
         * list of ignored user ids
-        * @var array<integer>
+        * @var integer[]
         */
        protected $ignoredUserIDs = null;
        
        /**
         * list of follower user ids
-        * @var array<integer>
+        * @var integer[]
         */
        protected $followerUserIDs = null;
        
        /**
         * list of following user ids
-        * @var array<integer>
+        * @var integer[]
         */
        protected $followingUserIDs = null;
        
        /**
         * user avatar
-        * @var \wcf\data\user\avatar\IUserAvatar
+        * @var IUserAvatar
         */
        protected $avatar = null;
        
        /**
         * user rank object
-        * @var \wcf\data\user\rank\UserRank
+        * @var UserRank
         */
        protected $rank = null;
        
@@ -98,7 +100,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
        const ACCESS_NOBODY = 3;
        
        /**
-        * @see \wcf\data\user\User::__toString()
+        * @inheritDoc
         */
        public function __toString() {
                return $this->getDecoratedObject()->__toString();
@@ -107,11 +109,11 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
        /**
         * Returns a list of all user ids being followed by current user.
         * 
-        * @return      array<integer>
+        * @return      integer[]
         */
        public function getFollowingUsers() {
                if ($this->followingUserIDs === null) {
-                       $this->followingUserIDs = array();
+                       $this->followingUserIDs = [];
                        
                        if ($this->userID) {
                                // get ids
@@ -123,7 +125,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                                                FROM    wcf".WCF_N."_user_follow
                                                WHERE   userID = ?";
                                        $statement = WCF::getDB()->prepareStatement($sql);
-                                       $statement->execute(array($this->userID));
+                                       $statement->execute([$this->userID]);
                                        while ($row = $statement->fetchArray()) {
                                                $this->followingUserIDs[] = $row['followUserID'];
                                        }
@@ -143,11 +145,11 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
        /**
         * Returns a list of user ids following current user.
         * 
-        * @return      array<integer>
+        * @return      integer[]
         */
        public function getFollowers() {
                if ($this->followerUserIDs === null) {
-                       $this->followerUserIDs = array();
+                       $this->followerUserIDs = [];
                        
                        if ($this->userID) {
                                // get ids
@@ -159,7 +161,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                                                FROM    wcf".WCF_N."_user_follow
                                                WHERE   followUserID = ?";
                                        $statement = WCF::getDB()->prepareStatement($sql);
-                                       $statement->execute(array($this->userID));
+                                       $statement->execute([$this->userID]);
                                        while ($row = $statement->fetchArray()) {
                                                $this->followerUserIDs[] = $row['userID'];
                                        }
@@ -179,11 +181,11 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
        /**
         * Returns a list of ignored user ids.
         * 
-        * @return      array<integer>
+        * @return      integer[]
         */
        public function getIgnoredUsers() {
                if ($this->ignoredUserIDs === null) {
-                       $this->ignoredUserIDs = array();
+                       $this->ignoredUserIDs = [];
                        
                        if ($this->userID) {
                                // get ids
@@ -195,7 +197,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                                                FROM    wcf".WCF_N."_user_ignore
                                                WHERE   userID = ?";
                                        $statement = WCF::getDB()->prepareStatement($sql);
-                                       $statement->execute(array($this->userID));
+                                       $statement->execute([$this->userID]);
                                        while ($row = $statement->fetchArray()) {
                                                $this->ignoredUserIDs[] = $row['ignoreUserID'];
                                        }
@@ -243,9 +245,9 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
        }
        
        /**
-        * Gets the user's avatar.
+        * Returns the user's avatar.
         * 
-        * @return      \wcf\data\user\avatar\IUserAvatar
+        * @return      IUserAvatar
         */
        public function getAvatar() {
                if ($this->avatar === null) {
@@ -319,10 +321,10 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
        public function getCurrentLocation() {
                if ($this->currentLocation === null) {
                        $this->currentLocation = '';
-                       $this->currentLocation = UserOnlineLocationHandler::getInstance()->getLocation(new UserOnline(new User(null, array(
+                       $this->currentLocation = UserOnlineLocationHandler::getInstance()->getLocation(new UserOnline(new User(null, [
                                'controller' => $this->controller,
                                'objectID' => $this->locationObjectID
-                       ))));
+                       ])));
                }
                
                return $this->currentLocation;
@@ -341,22 +343,22 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
         * Returns a new user profile object.
         * 
         * @param       integer                         $userID
-        * @return      \wcf\data\user\UserProfile
-        * @deprecated  use UserProfileCache::getUserProfile()
+        * @return      UserProfile
+        * @deprecated  since 2.2, use UserProfileRuntimeCache::getObject()
         */
        public static function getUserProfile($userID) {
-               return UserProfileCache::getInstance()->getUserProfile($userID);
+               return UserProfileRuntimeCache::getInstance()->getObject($userID);
        }
        
        /**
         * Returns a list of user profiles.
         * 
-        * @param       array                           $userIDs
-        * @return      array<\wcf\data\user\UserProfile>
-        * @deprecated  use UserProfileCache::getUserProfiles()
+        * @param       integer[]               $userIDs
+        * @return      UserProfile[]
+        * @deprecated  since 2.2, use UserProfileRuntimeCache::getObjects()
         */
        public static function getUserProfiles(array $userIDs) {
-               $users = UserProfileCache::getInstance()->getUserProfiles($userIDs);
+               $users = UserProfileRuntimeCache::getInstance()->getObjects($userIDs);
                
                // this method does not return null for non-existing user profiles
                foreach ($users as $userID => $user) {
@@ -371,12 +373,11 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
        /**
         * Returns the user profile of the user with the given name.
         * 
-        * @param       string                          $username
-        * @return      \wcf\data\user\UserProfile
-        * @todo        move to UserProfileCache?
+        * @param       string          $username
+        * @return      UserProfile
         */
        public static function getUserProfileByUsername($username) {
-               $users = self::getUserProfilesByUsername(array($username));
+               $users = self::getUserProfilesByUsername([$username]);
                
                return $users[$username];
        }
@@ -384,15 +385,14 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
        /**
         * Returns the user profiles of the users with the given names.
         * 
-        * @param       array<string>                   $usernames
-        * @return      array<\wcf\data\user\UserProfile>
-        * @todo        move to UserProfileCache?
+        * @param       string[]        $usernames
+        * @return      UserProfile[]
         */
        public static function getUserProfilesByUsername(array $usernames) {
-               $users = array();
+               $users = [];
                
                // save case sensitive usernames
-               $caseSensitiveUsernames = array();
+               $caseSensitiveUsernames = [];
                foreach ($usernames as &$username) {
                        $tmp = mb_strtolower($username);
                        $caseSensitiveUsernames[$tmp] = $username;
@@ -401,7 +401,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                unset($username);
                
                // check cache
-               $userProfiles = UserProfileCache::getInstance()->getCachedUserProfiles();
+               $userProfiles = UserProfileRuntimeCache::getInstance()->getCachedObjects();
                foreach ($usernames as $index => $username) {
                        foreach ($userProfiles as $user) {
                                if (mb_strtolower($user->username) === $username) {
@@ -413,7 +413,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                
                if (!empty($usernames)) {
                        $userList = new UserProfileList();
-                       $userList->getConditionBuilder()->add("user_table.username IN (?)", array($usernames));
+                       $userList->getConditionBuilder()->add("user_table.username IN (?)", [$usernames]);
                        $userList->readObjects();
                        
                        foreach ($userList as $user) {
@@ -576,13 +576,13 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
        /**
         * Returns the user rank.
         * 
-        * @return      \wcf\data\user\rank\UserRank
+        * @return      UserRank
         */
        public function getRank() {
                if ($this->rank === null) {
                        if (MODULE_USER_RANK && $this->rankID) {
                                if ($this->rankTitle) {
-                                       $this->rank = new UserRank(null, array(
+                                       $this->rank = new UserRank(null, [
                                                'rankID' => $this->rankID,
                                                'groupID' => $this->groupID,
                                                'requiredPoints' => $this->requiredPoints,
@@ -591,7 +591,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                                                'rankImage' => $this->rankImage,
                                                'repeatImage' => $this->repeatImage,
                                                'requiredGender' => $this->requiredGender
-                                       ));
+                                       ]);
                                }
                                else {
                                        // load storage data
@@ -618,7 +618,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                // get group data from cache
                $this->groupData = UserGroupPermissionCacheBuilder::getInstance()->getData($this->getGroupIDs());
                if (isset($this->groupData['groupIDs']) && $this->groupData['groupIDs'] != $this->getGroupIDs()) {
-                       $this->groupData = array();
+                       $this->groupData = [];
                }
        }
        
@@ -647,12 +647,12 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
        }
        
        /**
-        * @see \wcf\system\breadcrumb\IBreadcrumbProvider::getBreadcrumb()
+        * @inheritDoc
         */
        public function getBreadcrumb() {
-               return new Breadcrumb($this->username, LinkHandler::getInstance()->getLink('User', array(
+               return new Breadcrumb($this->username, LinkHandler::getInstance()->getLink('User', [
                        'object' => $this
-               )));
+               ]));
        }
        
        /**
@@ -787,7 +787,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
         * @return      string
         */
        public function getAnchorTag() {
-               $link = LinkHandler::getInstance()->getLink('User', array('object' => $this->getDecoratedObject()));
+               $link = LinkHandler::getInstance()->getLink('User', ['object' => $this->getDecoratedObject()]);
                
                return '<a href="'.$link.'" class="userLink" data-user-id="'.$this->userID.'">'.StringUtil::encodeHtml($this->username).'</a>';
        }
index c0ba5c39da9e0d8ef664d5d44465062d52905f4b..7eb0afa824433aa55a99242cb66177d642c35897 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\data\user;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\SingletonFactory;
 
 /**
@@ -12,105 +13,42 @@ use wcf\system\SingletonFactory;
  * @subpackage data.user
  * @category   Community Framework
  * @since      2.2
+ * 
+ * @todo       remove this class again
  */
 class UserProfileCache extends SingletonFactory {
        /**
-        * cached user ids whose profiles will be loaded during the next request
-        * @var array<integer>
-        */
-       protected $userIDs = array();
-       
-       /**
-        * locally cached user profiles
-        * @var array<\wcf\data\user\UserProfile>
-        */
-       protected $userProfiles = array();
-       
-       /**
-        * Caches the given user id.
-        * 
-        * @param       integer         $userID
+        * @see UserProfiltRuntimeCache::cacheObjectID()
         */
        public function cacheUserID($userID) {
-               $this->userIDs[] = $userID;
+               UserProfileRuntimeCache::getInstance()->cacheObjectID($userID);
        }
        
        /**
-        * Caches the given user ids.
-        * 
-        * @param       array<integer>          $userIDs
+        * @see UserProfiltRuntimeCache::cacheUserIDs()
         */
        public function cacheUserIDs(array $userIDs) {
-               $this->userIDs = array_merge($this->userIDs, $userIDs);
+               UserProfileRuntimeCache::getInstance()->cacheObjectIDs($userIDs);
        }
        
        /**
-        * Returns all currently cached user profile objects.
-        * 
-        * @return      array<\wcf\data\user\UserProfile>
+        * @see UserProfiltRuntimeCache::getCachedObjects()
         */
        public function getCachedUserProfiles() {
-               return $this->userProfiles;
+               return UserProfileRuntimeCache::getInstance()->getCachedObjects();
        }
        
        /**
-        * Returns the user profile of the user with the given user id. If no such
-        * user profile exists, null is returned.
-        * 
-        * @param       integer         $userID
-        * @return      \wcf\data\user\UserProfile
+        * @see UserProfiltRuntimeCache::getObject()
         */
        public function getUserProfile($userID) {
-               if (array_key_exists($userID, $this->userProfiles)) {
-                       return $this->userProfiles[$userID];
-               }
-               
-               return $this->getUserProfiles(array($userID))[$userID];
+               return UserProfileRuntimeCache::getInstance()->getObject($userID);
        }
        
        /**
-        * Returns the user profiles of the users with the given user ids. For ids
-        * without a user profile, null is returned.
-        * 
-        * @param       array<integer>          $userIDs
-        * @return      array<\wcf\data\user\UserProfile>
+        * @see UserProfiltRuntimeCache::getObjects()
         */
        public function getUserProfiles(array $userIDs) {
-               $userProfiles = array();
-               foreach ($userIDs as $key => $userID) {
-                       if (array_key_exists($userID, $this->userProfiles)) {
-                               $userProfiles[$userID] = $this->userProfiles[$userID];
-                               
-                               unset($userIDs[$key]);
-                       }
-               }
-               
-               if (empty($userIDs)) {
-                       return $userProfiles;
-               }
-               
-               $this->userIDs = array_unique(array_merge($this->userIDs, $userIDs));
-               
-               $userProfileList = new UserProfileList();
-               $userProfileList->setObjectIDs($this->userIDs);
-               $userProfileList->readObjects();
-               $readUserProfiles = $userProfileList->getObjects();
-               
-               foreach ($this->userIDs as $userID) {
-                       if (!isset($readUserProfiles[$userID])) {
-                               $this->userProfiles[$userID] = null;
-                       }
-                       else {
-                               $this->userProfiles[$userID] = $readUserProfiles[$userID];
-                       }
-               }
-               
-               $this->userIDs = array();
-               
-               foreach ($userIDs as $userID) {
-                       $userProfiles[$userID] = $this->userProfiles[$userID];
-               }
-               
-               return $userProfiles;
+               return UserProfileRuntimeCache::getInstance()->getObjects($userIDs);
        }
 }
index 19e6736ba0b50faf7ae6882616f4d4f923499d5e..4c1126b8ee76da23ef8f5b2e8ed7accdcfb9e260 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 namespace wcf\data\user\activity\event;
 use wcf\data\user\UserProfile;
-use wcf\data\user\UserProfileCache;
 use wcf\data\DatabaseObjectDecorator;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\user\activity\event\UserActivityEventHandler;
 
 /**
  * Provides methods for viewable user activity events.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.user.activity.event
@@ -17,9 +17,9 @@ use wcf\system\user\activity\event\UserActivityEventHandler;
  */
 class ViewableUserActivityEvent extends DatabaseObjectDecorator {
        /**
-        * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+        * @inheritDoc
         */
-       public static $baseClass = 'wcf\data\user\activity\event\UserActivityEvent';
+       public static $baseClass = UserActivityEvent::class;
        
        /**
         * event text
@@ -47,7 +47,7 @@ class ViewableUserActivityEvent extends DatabaseObjectDecorator {
        
        /**
         * user profile
-        * @var \wcf\data\user\UserProfile
+        * @var UserProfile
         */
        protected $userProfile = null;
        
@@ -86,7 +86,7 @@ class ViewableUserActivityEvent extends DatabaseObjectDecorator {
        /**
         * Sets user profile.
         * 
-        * @param       \wcf\data\user\UserProfile      $userProfile
+        * @param       UserProfile     $userProfile
         */
        public function setUserProfile(UserProfile $userProfile) {
                $this->userProfile = $userProfile;
@@ -95,11 +95,11 @@ class ViewableUserActivityEvent extends DatabaseObjectDecorator {
        /**
         * Returns user profile.
         * 
-        * @return      \wcf\data\user\UserProfile
+        * @return      UserProfile
         */
        public function getUserProfile() {
                if ($this->userProfile === null) {
-                       $this->userProfile = UserProfileCache::getInstance()->getUserProfile($this->userID);
+                       $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->userID);
                }
                
                return $this->userProfile;
index afdb5f3b38d665d8295cdcba8c7a15b2d80cf209..4c1812abe64168fee8a480abfafbaa616e1453d0 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 namespace wcf\data\user\activity\event;
-use wcf\data\user\UserProfileCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\language\LanguageFactory;
 use wcf\system\user\activity\event\UserActivityEventHandler;
 use wcf\system\WCF;
@@ -9,7 +9,7 @@ use wcf\system\WCF;
  * Represents a list of viewable user activity events.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.user.activity.event
@@ -17,9 +17,9 @@ use wcf\system\WCF;
  */
 class ViewableUserActivityEventList extends UserActivityEventList {
        /**
-        * @see \wcf\data\DatabaseObjectList::$className
+        * @inheritDoc
         */
-       public $className = 'wcf\data\user\activity\event\UserActivityEvent';
+       public $className = UserActivityEvent::class;
        
        /**
         * @see \wcf\data\DatabaseObjectList::$decoratorClassName
@@ -27,43 +27,43 @@ class ViewableUserActivityEventList extends UserActivityEventList {
        public $decoratorClassName = ViewableUserActivityEvent::class;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$sqlLimit
+        * @inheritDoc
         */
        public $sqlLimit = 20;
        
        /**
-        * @see \wcf\data\DatabaseObjectList::$sqlOrderBy
+        * @inheritDoc
         */
        public $sqlOrderBy = 'user_activity_event.time DESC, user_activity_event.eventID DESC';
        
        /**
-        * Creates a new ViewableUserActivityEventList object.
+        * @inheritDoc
         */
        public function __construct() {
                parent::__construct();
                
                if (LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) {
-                       $this->getConditionBuilder()->add('(user_activity_event.languageID IN (?) OR user_activity_event.languageID IS NULL)', array(WCF::getUser()->getLanguageIDs()));
+                       $this->getConditionBuilder()->add('(user_activity_event.languageID IN (?) OR user_activity_event.languageID IS NULL)', [WCF::getUser()->getLanguageIDs()]);
                }
        }
        
        /**
-        * @see \wcf\data\DatabaseObjectList::readObjects()
+        * @inheritDoc
         */
        public function readObjects() {
                parent::readObjects();
                
-               $userIDs = array();
-               $eventGroups = array();
+               $userIDs = [];
+               $eventGroups = [];
                foreach ($this->objects as $event) {
                        $userIDs[] = $event->userID;
                        
                        if (!isset($eventGroups[$event->objectTypeID])) {
                                $objectType = UserActivityEventHandler::getInstance()->getObjectType($event->objectTypeID);
-                               $eventGroups[$event->objectTypeID] = array(
+                               $eventGroups[$event->objectTypeID] = [
                                        'className' => $objectType->className,
-                                       'objects' => array()
-                               );
+                                       'objects' => []
+                               ];
                        }
                        
                        $eventGroups[$event->objectTypeID]['objects'][] = $event;
@@ -71,12 +71,12 @@ class ViewableUserActivityEventList extends UserActivityEventList {
                
                // set user profiles
                if (!empty($userIDs)) {
-                       UserProfileCache::getInstance()->cacheUserIDs(array_unique($userIDs));
+                       UserProfileRuntimeCache::getInstance()->cacheObjectIDs(array_unique($userIDs));
                }
                
                // parse events
                foreach ($eventGroups as $eventData) {
-                       $eventClass = call_user_func(array($eventData['className'], 'getInstance'));
+                       $eventClass = call_user_func([$eventData['className'], 'getInstance']);
                        $eventClass->prepare($eventData['objects']);
                }
        }
@@ -102,10 +102,10 @@ class ViewableUserActivityEventList extends UserActivityEventList {
        /**
         * Validates event permissions and returns a list of orphaned event ids.
         * 
-        * @return      array<integer>
+        * @return      integer[]
         */
        public function validateEvents() {
-               $orphanedEventIDs = array();
+               $orphanedEventIDs = [];
                
                foreach ($this->objects as $index => $event) {
                        if ($event->isOrphaned()) {
diff --git a/wcfsetup/install/files/lib/system/cache/runtime/AbstractRuntimeCache.class.php b/wcfsetup/install/files/lib/system/cache/runtime/AbstractRuntimeCache.class.php
new file mode 100644 (file)
index 0000000..4e23779
--- /dev/null
@@ -0,0 +1,142 @@
+<?php
+namespace wcf\system\cache\runtime;
+use wcf\data\DatabaseObject;
+use wcf\data\DatabaseObjectList;
+use wcf\system\SingletonFactory;
+
+/**
+ * Abstract implementation of a runtime cache.
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2016 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache.runtime
+ * @category   Community Framework
+ * @since      2.2
+ */
+abstract class AbstractRuntimeCache extends SingletonFactory implements IRuntimeCache {
+       /**
+        * name of the DatabaseObjectList class
+        * @var string
+        */
+       protected $listClassName = '';
+       
+       /**
+        * ids of objects which will be fetched next
+        * @var integer[]
+        */
+       protected $objectIDs = [];
+       
+       /**
+        * cached DatabaseObject objects
+        * @var DatabaseObject[]
+        */
+       protected $objects = [];
+       
+       /**
+        * @inheritDoc
+        */
+       public function cacheObjectID($objectID) {
+               $this->cacheObjectIDs([$objectID]);
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function cacheObjectIDs(array $objectIDs) {
+               foreach ($objectIDs as $objectID) {
+                       if (!array_key_exists($objectID, $this->objects) && !in_array($objectID, $this->objectIDs)) {
+                               $this->objectIDs[] = $objectID;
+                       }
+               }
+       }
+       
+       /**
+        * Fetches the objects for the pending object ids.
+        */
+       protected function fetchObjects() {
+               /** @var DatabaseObjectList $objectList */
+               $objectList = new $this->listClassName;
+               $objectList->setObjectIDs($this->objectIDs);
+               $objectList->readObjects();
+               $this->objects += $objectList->getObjects();
+               
+               // create null entries for non-existing objects
+               foreach ($this->objectIDs as $objectID) {
+                       if (!array_key_exists($objectID, $this->objects)) {
+                               $this->objects[$objectID] = null;
+                       }
+               }
+               
+               $this->objectIDs = [];
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function getCachedObjects() {
+               return $this->objects;
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function getObject($objectID) {
+               if (array_key_exists($objectID, $this->objects)) {
+                       return $this->objects[$objectID];
+               }
+               
+               $this->cacheObjectID($objectID);
+               
+               $this->fetchObjects();
+               
+               return $this->objects[$objectID];
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function getObjects(array $objectIDs) {
+               $objects = [];
+               
+               // set already cached objects
+               foreach ($objectIDs as $key => $objectID) {
+                       if (array_key_exists($objectID, $this->objects)) {
+                               $objects[$objectID] = $this->objects[$objectID];
+                               unset($objectIDs[$key]);
+                       }
+               }
+               
+               if (!empty($objectIDs)) {
+                       $this->cacheObjectIDs($objectIDs);
+                       
+                       $this->fetchObjects();
+                       
+                       // set newly loaded cached objects
+                       foreach ($objectIDs as $objectID) {
+                               $objects[$objectID] = $this->objects[$objectID];
+                       }
+               }
+               
+               return $objects;
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function removeObject($objectID) {
+               $this->removeObjects([$objectID]);
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function removeObjects(array $objectIDs){
+               foreach ($objectIDs as $objectID) {
+                       if (array_key_exists($objectID, $this->objects)) {
+                               unset($this->objects[$objectID]);
+                       }
+               }
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/cache/runtime/CommentRuntimeCache.class.php b/wcfsetup/install/files/lib/system/cache/runtime/CommentRuntimeCache.class.php
new file mode 100644 (file)
index 0000000..18bf7e7
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+namespace wcf\system\cache\runtime;
+use wcf\data\comment\Comment;
+use wcf\data\comment\CommentList;
+
+/**
+ * Runtime cache implementation for comments.
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2016 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache.runtime
+ * @category   Community Framework
+ * @since      2.2
+ * 
+ * @method     Comment         getObject($objectID)
+ * @method     Comment[]       getObjects(array $objectIDs)
+ */
+class CommentRuntimeCache extends AbstractRuntimeCache {
+       /**
+        * @inheritDoc
+        */
+       protected $listClassName = CommentList::class;
+}
diff --git a/wcfsetup/install/files/lib/system/cache/runtime/IRuntimeCache.class.php b/wcfsetup/install/files/lib/system/cache/runtime/IRuntimeCache.class.php
new file mode 100644 (file)
index 0000000..d81bc7e
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+namespace wcf\system\cache\runtime;
+use wcf\data\DatabaseObject;
+
+/**
+ * Handles runtime caches to centrally store objects fetched during tuntime for reuse.
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2016 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache.runtime
+ * @category   Community Framework
+ * @since      2.2
+ */
+interface IRuntimeCache {
+       /**
+        * Caches the given object id so that during the next object fetch, the object with
+        * this id will also be fetched.
+        * 
+        * @param       integer         $objectID
+        */
+       public function cacheObjectID($objectID);
+       
+       /**
+        * Caches the given object ids so that during the next object fetch, the objects with
+        * these ids will also be fetched.
+        * 
+        * @param       integer[]       $objectIDs
+        */
+       public function cacheObjectIDs(array $objectIDs);
+       
+       /**
+        * Returns all currently cached objects.
+        * 
+        * @return      DatabaseObject[]
+        */
+       public function getCachedObjects();
+       
+       /**
+        * Returns the object with the given id or null if no such object exists.
+        * If the given object id should not have been cached before, it will be cached
+        * during this method call and the object, if existing, will be returned.
+        * 
+        * @param       integer         $objectID
+        * @return      DatabaseObject|null
+        */
+       public function getObject($objectID);
+       
+       /**
+        * Returns the objects with the given ids. If an object does not exist, the array element
+        * wil be null.
+        * If the given object ids should not have been cached before, they will be cached
+        * during this method call and the objects, if existing, will be returned.
+        * 
+        * @param       integer[]       $objectIDs
+        * @return      DatabaseObject[]
+        */
+       public function getObjects(array $objectIDs);
+       
+       /**
+        * Removes the object with the given id from the runtime cache if it has already been loaded.
+        * 
+        * @param       integer         $objectID
+        */
+       public function removeObject($objectID);
+       
+       
+       /**
+        * Removes the objects with the given ids from the runtime cache if they have already been loaded.
+        *
+        * @param       integer         $objectID
+        */
+       public function removeObjects(array $objectIDs);
+}
diff --git a/wcfsetup/install/files/lib/system/cache/runtime/UserProfileRuntimeCache.class.php b/wcfsetup/install/files/lib/system/cache/runtime/UserProfileRuntimeCache.class.php
new file mode 100644 (file)
index 0000000..1734fbb
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+namespace wcf\system\cache\runtime;
+use wcf\data\user\UserProfile;
+use wcf\data\user\UserProfileList;
+
+/**
+ * Runtime cache implementation for user profiles.
+ *
+ * @author     Matthias Schmidt
+ * @copyright  2001-2016 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache.runtime
+ * @category   Community Framework
+ * @since      2.2
+ * 
+ * @method     UserProfile     getObject($objectID)
+ * @method     UserProfile[]   getObjects(array $objectIDs)
+ */
+class UserProfileRuntimeCache extends AbstractRuntimeCache {
+       /**
+        * @inheritDoc
+        */
+       protected $listClassName = UserProfileList::class;
+}
index 627ff32ed0326d15bc90bf89874ec4abfb8afd51..df756a4973416da14132b4075ea569834bb74201 100644 (file)
@@ -1,98 +1,46 @@
 <?php
 namespace wcf\system\comment;
-use wcf\data\comment\CommentList;
-use wcf\data\user\UserProfile;
+use wcf\system\cache\runtime\CommentRuntimeCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\SingletonFactory;
 
 /**
  * Handles common data resources for comment-related user notifications
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.comment
  * @category   Community Framework
+ * @deprecated since 2.2, use CommentRuntimeCache and UserProfileRuntimeCache
  */
 class CommentDataHandler extends SingletonFactory {
        /**
-        * list of comment ids
-        * @var array<integer>
-        */
-       protected $commentIDs = array();
-       
-       /**
-        * list of cached comment objects
-        * @var array<\wcf\data\comment\Comment>
-        */
-       protected $comments = array();
-       
-       /**
-        * list of user ids
-        * @var array<integer>
-        */
-       protected $userIDs = array();
-       
-       /**
-        * Caches a comment id.
-        * 
-        * @param       integer         $commentID
+        * @see CommentRuntimeCache::cacheObjectID()
         */
        public function cacheCommentID($commentID) {
-               if (!in_array($commentID, $this->commentIDs)) {
-                       $this->commentIDs[] = $commentID;
-               }
+               CommentRuntimeCache::getInstance()->cacheObjectID($commentID);
        }
        
        /**
-        * Caches a user id.
-        * 
-        * @param       integer         $userID
+        * @see UserProfileRuntimeCache::cacheObjectID()
         */
        public function cacheUserID($userID) {
-               if (!in_array($userID, $this->userIDs)) {
-                       $this->userIDs[] = $userID;
-               }
+               UserProfileRuntimeCache::getInstance()->cacheObjectID($userID);
        }
        
        /**
-        * Returns a comment by id, fetches comments on first call.
-        * 
-        * @param       integer         $commentID
-        * @return      \wcf\data\comment\Comment
+        * @see CommentRuntimeCache::getComment()
         */
        public function getComment($commentID) {
-               if (!empty($this->commentIDs)) {
-                       $this->commentIDs = array_diff($this->commentIDs, array_keys($this->comments));
-                       
-                       if (!empty($this->commentIDs)) {
-                               $commentList = new CommentList();
-                               $commentList->setObjectIDs($this->commentIDs);
-                               $commentList->readObjects();
-                               $this->comments += $commentList->getObjects();
-                               $this->commentIDs = array();
-                       }
-               }
-               
-               if (isset($this->comments[$commentID])) {
-                       return $this->comments[$commentID];
-               }
-               
-               return null;
+               return CommentRuntimeCache::getInstance()->getObject($commentID);
        }
        
        /**
-        * Returns a user profile by id, fetches user profiles on first call.
-        * 
-        * @param       integer         $userID
-        * @return      \wcf\data\user\UserProfile
+        * @see UserProfileRuntimeCache::getObject()
         */
        public function getUser($userID) {
-               if (!empty($this->userIDs)) {
-                       UserProfile::getUserProfiles($this->userIDs);
-                       $this->userIDs = array();
-               }
-               
-               return UserProfile::getUserProfile($userID);
+               return UserProfileRuntimeCache::getInstance()->getObject($userID);
        }
 }
index 50895a1af33dd43f675ff48e7fd0eddb6bc28491..692fb5612a56d0db2b85a4de26db8141004cab86 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 namespace wcf\system\dashboard\box;
 use wcf\data\dashboard\box\DashboardBox;
-use wcf\data\user\UserProfileCache;
 use wcf\data\DatabaseObject;
 use wcf\page\IPage;
 use wcf\system\cache\builder\MostActiveMembersCacheBuilder;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 
@@ -12,7 +12,7 @@ use wcf\system\WCF;
  * Shows a list of the most active members.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.dashboard.box
@@ -21,12 +21,12 @@ use wcf\system\WCF;
 class MostActiveMembersDashboardBox extends AbstractSidebarDashboardBox {
        /**
         * ids of the most active members
-        * @var array<integer>
+        * @var integer[]
         */
-       public $mostActiveMemberIDs = array();
+       public $mostActiveMemberIDs = [];
        
        /**
-        * @see \wcf\system\dashboard\box\AbstractDashboardBoxContent::init()
+        * @inheritDoc
         */
        public function init(DashboardBox $box, IPage $page) {
                parent::init($box, $page);
@@ -34,28 +34,28 @@ class MostActiveMembersDashboardBox extends AbstractSidebarDashboardBox {
                // get ids
                $this->mostActiveMemberIDs = MostActiveMembersCacheBuilder::getInstance()->getData();
                if (!empty($this->mostActiveMemberIDs)) {
-                       UserProfileCache::getInstance()->cacheUserIDs($this->mostActiveMemberIDs);
+                       UserProfileRuntimeCache::getInstance()->cacheObjectIDs($this->mostActiveMemberIDs);
                }
                
                $this->fetched();
        }
        
        /**
-        * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render()
+        * @inheritDoc
         */
        protected function render() {
                if (empty($this->mostActiveMemberIDs)) return '';
                
                if (MODULE_MEMBERS_LIST) {
-                       $this->titleLink = LinkHandler::getInstance()->getLink('MembersList', array(), 'sortField=activityPoints&sortOrder=DESC');
+                       $this->titleLink = LinkHandler::getInstance()->getLink('MembersList', [], 'sortField=activityPoints&sortOrder=DESC');
                }
                
-               $mostActiveMembers = UserProfileCache::getInstance()->getUserProfiles($this->mostActiveMemberIDs);
+               $mostActiveMembers = UserProfileRuntimeCache::getInstance()->getObjects($this->mostActiveMemberIDs);
                DatabaseObject::sort($mostActiveMembers, 'activityPoints', 'DESC');
                
-               WCF::getTPL()->assign(array(
+               WCF::getTPL()->assign([
                        'mostActiveMembers' => $mostActiveMembers
-               ));
+               ]);
                return WCF::getTPL()->fetch('dashboardBoxMostActiveMembers');
        }
 }
index fa80d6ad91708e26ca9951f30ee309cb7395be0a..997651863c75c8b0ff22d0f22418553e38633aa7 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 namespace wcf\system\dashboard\box;
 use wcf\data\dashboard\box\DashboardBox;
-use wcf\data\user\UserProfileCache;
 use wcf\data\DatabaseObject;
 use wcf\page\IPage;
 use wcf\system\cache\builder\MostLikedMembersCacheBuilder;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 
@@ -12,7 +12,7 @@ use wcf\system\WCF;
  * Shows a list of the most liked members.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.dashboard.box
@@ -21,12 +21,12 @@ use wcf\system\WCF;
 class MostLikedMembersDashboardBox extends AbstractSidebarDashboardBox {
        /**
         * ids of the most liked members
-        * @var array<integer>
+        * @var integer[]
         */
-       public $mostLikedMemberIDs = array();
+       public $mostLikedMemberIDs = [];
        
        /**
-        * @see \wcf\system\dashboard\box\IDashboardBox::init()
+        * @inheritDoc
         */
        public function init(DashboardBox $box, IPage $page) {
                parent::init($box, $page);
@@ -37,26 +37,26 @@ class MostLikedMembersDashboardBox extends AbstractSidebarDashboardBox {
                $this->fetched();
                
                if (!empty($this->mostLikedMemberIDs)) {
-                       UserProfileCache::getInstance()->cacheUserIDs($this->mostLikedMemberIDs);
+                       UserProfileRuntimeCache::getInstance()->cacheObjectIDs($this->mostLikedMemberIDs);
                }
        }
        
        /**
-        * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render()
+        * @inheritDoc
         */
        protected function render() {
                if (empty($this->mostLikedMemberIDs)) return '';
                
                if (MODULE_MEMBERS_LIST) {
-                       $this->titleLink = LinkHandler::getInstance()->getLink('MembersList', array(), 'sortField=likesReceived&sortOrder=DESC');
+                       $this->titleLink = LinkHandler::getInstance()->getLink('MembersList', [], 'sortField=likesReceived&sortOrder=DESC');
                }
                
-               $mostLikedMembers = UserProfileCache::getInstance()->getUserProfiles($this->mostLikedMemberIDs);
+               $mostLikedMembers = UserProfileRuntimeCache::getInstance()->getObjects($this->mostLikedMemberIDs);
                DatabaseObject::sort($mostLikedMembers, 'likesReceived', 'DESC');
                
-               WCF::getTPL()->assign(array(
+               WCF::getTPL()->assign([
                        'mostLikedMembers' => $mostLikedMembers
-               ));
+               ]);
                return WCF::getTPL()->fetch('dashboardBoxMostLikedMembers');
        }
 }
index 2d807c3525b6da2f3149bb91968448c5d71487a5..a304fe0fa2326434b9894a77c854c56cb280f64e 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 namespace wcf\system\dashboard\box;
 use wcf\data\dashboard\box\DashboardBox;
-use wcf\data\user\UserProfileCache;
 use wcf\data\DatabaseObject;
 use wcf\page\IPage;
 use wcf\system\cache\builder\NewestMembersCacheBuilder;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 
@@ -12,7 +12,7 @@ use wcf\system\WCF;
  * Shows a list of the newest members.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.dashboard.box
@@ -21,12 +21,12 @@ use wcf\system\WCF;
 class NewestMembersDashboardBox extends AbstractSidebarDashboardBox {
        /**
         * ids of the newest members
-        * @var array<integer>
+        * @var integer[]
         */
-       public $newestMemberIDs = array();
+       public $newestMemberIDs = [];
        
        /**
-        * @see \wcf\system\dashboard\box\IDashboardBox::init()
+        * @inheritDoc
         */
        public function init(DashboardBox $box, IPage $page) {
                parent::init($box, $page);
@@ -34,28 +34,28 @@ class NewestMembersDashboardBox extends AbstractSidebarDashboardBox {
                // get ids
                $this->newestMemberIDs = NewestMembersCacheBuilder::getInstance()->getData();
                if (!empty($this->newestMemberIDs)) {
-                       UserProfileCache::getInstance()->cacheUserIDs($this->newestMemberIDs);
+                       UserProfileRuntimeCache::getInstance()->cacheObjectIDs($this->newestMemberIDs);
                }
                
                $this->fetched();
        }
        
        /**
-        * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render()
+        * @inheritDoc
         */
        protected function render() {
                if (empty($this->newestMemberIDs)) return '';
                
                if (MODULE_MEMBERS_LIST) {
-                       $this->titleLink = LinkHandler::getInstance()->getLink('MembersList', array(), 'sortField=registrationDate&sortOrder=DESC');
+                       $this->titleLink = LinkHandler::getInstance()->getLink('MembersList', [], 'sortField=registrationDate&sortOrder=DESC');
                }
                
-               $newestMembers = UserProfileCache::getInstance()->getUserProfiles($this->newestMemberIDs);
+               $newestMembers = UserProfileRuntimeCache::getInstance()->getObjects($this->newestMemberIDs);
                DatabaseObject::sort($newestMembers, 'registrationDate', 'DESC');
                
-               WCF::getTPL()->assign(array(
+               WCF::getTPL()->assign([
                        'newestMembers' => $newestMembers
-               ));
+               ]);
                return WCF::getTPL()->fetch('dashboardBoxNewestMembers');
        }
 }
index 3b6976e5b6982384bd788b6803446c85cd8a15a7..36256735aa2d9493e86b238a476da3557f1e9553 100644 (file)
@@ -1,9 +1,10 @@
 <?php
 namespace wcf\system\dashboard\box;
 use wcf\data\dashboard\box\DashboardBox;
-use wcf\data\user\UserProfileCache;
+use wcf\data\user\UserProfile;
 use wcf\page\IPage;
 use wcf\system\cache\builder\UserOptionCacheBuilder;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\user\UserBirthdayCache;
 use wcf\system\WCF;
 use wcf\util\DateUtil;
@@ -12,7 +13,7 @@ use wcf\util\DateUtil;
  * Shows today's birthdays.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.dashboard.box
@@ -21,12 +22,12 @@ use wcf\util\DateUtil;
 class TodaysBirthdaysDashboardBox extends AbstractSidebarDashboardBox {
        /**
         * user profiles
-        * @var array<\wcf\data\user\UserProfile>
+        * @var UserProfile[]
         */
-       public $userProfiles = array();
+       public $userProfiles = [];
        
        /**
-        * @see \wcf\system\dashboard\box\IDashboardBox::init()
+        * @inheritDoc
         */
        public function init(DashboardBox $box, IPage $page) {
                parent::init($box, $page);
@@ -39,11 +40,11 @@ class TodaysBirthdaysDashboardBox extends AbstractSidebarDashboardBox {
                $userIDs = UserBirthdayCache::getInstance()->getBirthdays($date[1], $date[2]);
                
                if (!empty($userIDs)) {
-                       $userOptions = UserOptionCacheBuilder::getInstance()->getData(array(), 'options');
+                       $userOptions = UserOptionCacheBuilder::getInstance()->getData([], 'options');
                        if (isset($userOptions['birthday'])) {
                                $birthdayUserOption = $userOptions['birthday'];
                                
-                               $userProfiles = UserProfileCache::getInstance()->getUserProfiles($userIDs);
+                               $userProfiles = UserProfileRuntimeCache::getInstance()->getObjects($userIDs);
                                
                                $i = 0;
                                foreach ($userProfiles as $userProfile) {
@@ -63,16 +64,16 @@ class TodaysBirthdaysDashboardBox extends AbstractSidebarDashboardBox {
        }
        
        /**
-        * @see \wcf\system\dashboard\box\AbstractContentDashboardBox::render()
+        * @inheritDoc
         */
        protected function render() {
                if (empty($this->userProfiles)) {
                        return '';
                }
                
-               WCF::getTPL()->assign(array(
+               WCF::getTPL()->assign([
                        'birthdayUserProfiles' => $this->userProfiles
-               ));
+               ]);
                return WCF::getTPL()->fetch('dashboardBoxTodaysBirthdays');
        }
 }
index f9867464ef983fb1c6c73a6feb1e66f7e4fb55fe..6061e644b9b48df7aa2a09bd953c4c473a05592a 100644 (file)
@@ -2,8 +2,8 @@
 namespace wcf\system\dashboard\box;
 use wcf\data\dashboard\box\DashboardBox;
 use wcf\data\user\UserProfile;
-use wcf\data\user\UserProfileCache;
 use wcf\page\IPage;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\user\UserBirthdayCache;
 use wcf\system\WCF;
 use wcf\util\DateUtil;
@@ -12,7 +12,7 @@ use wcf\util\DateUtil;
  * Shows today's birthdays of users the active user is following.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.dashboard.box
@@ -40,7 +40,7 @@ class TodaysFollowingBirthdaysDashboardBox extends AbstractSidebarDashboardBox {
                $userIDs = array_intersect($userIDs, WCF::getUserProfileHandler()->getFollowingUsers());
                
                if (!empty($userIDs)) {
-                       $userProfiles = UserProfileCache::getInstance()->getUserProfiles($userIDs);
+                       $userProfiles = UserProfileRuntimeCache::getInstance()->getObjects($userIDs);
                        
                        $i = 0;
                        foreach ($userProfiles as $userProfile) {
index d29a499a97f329be27ac45f0e216bba8e498a03d..96eb48763c97c949905ca2d7ec065b39a9470d2f 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace wcf\system\html\output\node;
 use wcf\data\user\UserProfile;
-use wcf\data\user\UserProfileCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\html\output\HtmlOutputNodeProcessor;
 use wcf\system\WCF;
 use wcf\util\StringUtil;
@@ -44,7 +44,7 @@ class HtmlOutputNodeWoltlabMention implements IHtmlOutputNode {
                }
                
                if (!empty($userIds)) {
-                       $this->userProfiles = UserProfileCache::getInstance()->getUserProfiles($userIds);
+                       $this->userProfiles = UserProfileRuntimeCache::getInstance()->getObjects($userIds);
                }
        }
        
index ce7d2d7ff24d34f3cf47280f8a13d49a2b699e40..905b9669875855cccdc54247f00862c3ea20ef3c 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 namespace wcf\system\message\embedded\object;
 use wcf\data\user\UserList;
-use wcf\data\user\UserProfileCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 
 /**
  * IMessageEmbeddedObjectHandler implementation for quotes.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.message.embedded.object
@@ -15,13 +15,13 @@ use wcf\data\user\UserProfileCache;
  */
 class QuoteMessageEmbeddedObjectHandler extends AbstractMessageEmbeddedObjectHandler {
        /**
-        * @see \wcf\system\message\embedded\object\IMessageEmbeddedObjectHandler::parseMessage()
+        * @inheritDoc
         */
        public function parseMessage($message) {
                $usernames = self::getFirstParameters($message, 'quote');
                if (!empty($usernames)) {
                        $userList = new UserList();
-                       $userList->getConditionBuilder()->add("user_table.username IN (?)", array($usernames));
+                       $userList->getConditionBuilder()->add("user_table.username IN (?)", [$usernames]);
                        $userList->readObjectIDs();
                        return $userList->getObjectIDs();
                }
@@ -30,9 +30,9 @@ class QuoteMessageEmbeddedObjectHandler extends AbstractMessageEmbeddedObjectHan
        }
        
        /**
-        * @see \wcf\system\message\embedded\object\IMessageEmbeddedObjectHandler::loadObjects()
+        * @inheritDoc
         */
        public function loadObjects(array $objectIDs) {
-               return UserProfileCache::getInstance()->getUserProfiles($objectIDs);
+               return UserProfileRuntimeCache::getInstance()->getObjects($objectIDs);
        }
 }
index 5e2e2a3fa9f8345a2b627e3c7ae3289a6e480c74..a683fbe6a0ad84fb2e8f349a5c8b1a7e2ce16ab8 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\system\user\activity\event;
 use wcf\data\comment\response\CommentResponseList;
 use wcf\data\comment\CommentList;
-use wcf\data\user\UserProfileCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
 
@@ -10,7 +10,7 @@ use wcf\system\WCF;
  * User activity event implementation for profile comment responses.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.user.activity.event
@@ -18,14 +18,14 @@ use wcf\system\WCF;
  */
 class ProfileCommentResponseUserActivityEvent extends SingletonFactory implements IUserActivityEvent {
        /**
-        * @see \wcf\system\user\activity\event\IUserActivityEvent::prepare()
+        * @inheritDoc
         */
        public function prepare(array $events) {
                if (!WCF::getSession()->getPermission('user.profile.canViewUserProfile')) {
                        return;
                }
                
-               $responses = $responseIDs = array();
+               $responses = $responseIDs = [];
                foreach ($events as $event) {
                        $responseIDs[] = $event->objectID;
                }
@@ -37,7 +37,7 @@ class ProfileCommentResponseUserActivityEvent extends SingletonFactory implement
                $responses = $responseList->getObjects();
                
                // fetch comments
-               $commentIDs = $comments = array();
+               $commentIDs = $comments = [];
                foreach ($responses as $response) {
                        $commentIDs[] = $response->commentID;
                }
@@ -49,13 +49,13 @@ class ProfileCommentResponseUserActivityEvent extends SingletonFactory implement
                }
                
                // fetch users
-               $userIDs = $users = array();
+               $userIDs = $users = [];
                foreach ($comments as $comment) {
                        $userIDs[] = $comment->objectID;
                        $userIDs[] = $comment->userID;
                }
                if (!empty($userIDs)) {
-                       $users = UserProfileCache::getInstance()->getUserProfiles($userIDs);
+                       $users = UserProfileRuntimeCache::getInstance()->getObjects($userIDs);
                }
                
                // set message
@@ -68,10 +68,10 @@ class ProfileCommentResponseUserActivityEvent extends SingletonFactory implement
                                                $event->setIsAccessible();
                                                
                                                // title
-                                               $text = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.recentActivity.profileCommentResponse', array(
+                                               $text = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.recentActivity.profileCommentResponse', [
                                                        'commentAuthor' => $users[$comment->userID],
                                                        'user' => $users[$comment->objectID]
-                                               ));
+                                               ]);
                                                $event->setTitle($text);
                                                
                                                // description
index c94fbe8c3235bf6ade2ef5c8346e32e129538112..9c47e732d8afdc9017de58a144b6a9d40a0b49cb 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace wcf\system\user\activity\event;
 use wcf\data\comment\CommentList;
-use wcf\data\user\UserProfileCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
 
@@ -9,7 +9,7 @@ use wcf\system\WCF;
  * User activity event implementation for profile comments.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.user.activity.event
@@ -17,7 +17,7 @@ use wcf\system\WCF;
  */
 class ProfileCommentUserActivityEvent extends SingletonFactory implements IUserActivityEvent {
        /**
-        * @see \wcf\system\user\activity\event\IUserActivityEvent::prepare()
+        * @inheritDoc
         */
        public function prepare(array $events) {
                if (!WCF::getSession()->getPermission('user.profile.canViewUserProfile')) {
@@ -41,7 +41,7 @@ class ProfileCommentUserActivityEvent extends SingletonFactory implements IUserA
                        $userIDs[] = $comment->objectID;
                }
                if (!empty($userIDs)) {
-                       $users = UserProfileCache::getInstance()->getUserProfiles($userIDs);
+                       $users = UserProfileRuntimeCache::getInstance()->getObjects($userIDs);
                }
                
                // set message
index d93b5c45e4250c46a2d0f4f90cd542d4b128244b..d48413a6f94ac2229cf7f035e509e0e010245874 100644 (file)
@@ -3,7 +3,9 @@ namespace wcf\system\user\notification\event;
 use wcf\data\user\User;
 use wcf\data\moderation\queue\ViewableModerationQueue;
 use wcf\data\object\type\ObjectTypeCache;
-use wcf\system\comment\CommentDataHandler;
+use wcf\data\user\UserProfile;
+use wcf\system\cache\runtime\CommentRuntimeCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\moderation\queue\report\IModerationQueueReportHandler;
 use wcf\system\WCF;
 
@@ -75,14 +77,14 @@ class ModerationQueueCommentResponseUserNotificationEvent extends AbstractShared
                        ]);
                }
                
-               $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
+               $comment = CommentRuntimeCache::getInstance()->getComment($this->userNotificationObject->commentID);
                if ($comment->userID) {
-                       $commentAuthor = CommentDataHandler::getInstance()->getUser($comment->userID);
+                       $commentAuthor = UserProfileRuntimeCache::getInstance()->getObject($comment->userID);
                }
                else {
-                       $commentAuthor = new User(null, [
+                       $commentAuthor = new UserProfile(new User(null, [
                                'username' => $comment->username
-                       ]);
+                       ]));
                }
                
                return $this->getLanguage()->getDynamicVariable($this->getLanguageItemPrefix().'.commentResponse.mail', [
@@ -127,14 +129,14 @@ class ModerationQueueCommentResponseUserNotificationEvent extends AbstractShared
                        ]);
                }
                
-               $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
+               $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID);
                if ($comment->userID) {
-                       $commentAuthor = CommentDataHandler::getInstance()->getUser($comment->userID);
+                       $commentAuthor = UserProfileRuntimeCache::getInstance()->getObject($comment->userID);
                }
                else {
-                       $commentAuthor = new User(null, [
+                       $commentAuthor = new UserProfile(new User(null, [
                                'username' => $comment->username
-                       ]);
+                       ]));
                }
                
                return $this->getLanguage()->getDynamicVariable($this->getLanguageItemPrefix().'.commentResponse.message', [
@@ -152,7 +154,7 @@ class ModerationQueueCommentResponseUserNotificationEvent extends AbstractShared
         */
        public function getModerationQueue() {
                if (!$this->moderationQueueLoaded) {
-                       $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
+                       $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID);
                        
                        $this->moderationQueue = ViewableModerationQueue::getViewableModerationQueue($comment->objectID);
                        $this->moderationQueueLoaded = true;
@@ -195,7 +197,7 @@ class ModerationQueueCommentResponseUserNotificationEvent extends AbstractShared
         * @inheritDoc
         */
        protected function prepare() {
-               CommentDataHandler::getInstance()->cacheCommentID($this->userNotificationObject->commentID);
-               CommentDataHandler::getInstance()->cacheUserID($this->additionalData['userID']);
+               CommentRuntimeCache::getInstance()->cacheObjectID($this->userNotificationObject->commentID);
+               UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['userID']);
        }
 }
index 649b21e8c6c3f34ae35ce94fb104f2dad97ef2f9..581e97a542f1febd6b6783df691c5807f1137a54 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 namespace wcf\system\user\notification\event;
-use wcf\system\comment\CommentDataHandler;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 
@@ -8,7 +8,7 @@ use wcf\system\WCF;
  * User notification event for profile commment likes.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.user.notification.event
@@ -16,87 +16,87 @@ use wcf\system\WCF;
  */
 class UserProfileCommentLikeUserNotificationEvent extends AbstractSharedUserNotificationEvent {
        /**
-        * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
+        * @inheritDoc
         */
        protected $stackable = true;
        
        /**
-        * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::prepare()
+        * @inheritDoc
         */
        protected function prepare() {
-               CommentDataHandler::getInstance()->cacheUserID($this->additionalData['objectID']);
+               UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['objectID']);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
+        * @inheritDoc
         */
        public function getTitle() {
                $count = count($this->getAuthors());
                if ($count > 1) {
-                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.title.stacked', array(
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.title.stacked', [
                                'count' => $count,
                                'timesTriggered' => $this->notification->timesTriggered
-                       ));
+                       ]);
                }
                
                return $this->getLanguage()->get('wcf.user.notification.comment.like.title');
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
+        * @inheritDoc
         */
        public function getMessage() {
                $authors = array_values($this->getAuthors());
                $count = count($authors);
                $owner = null;
                if ($this->additionalData['objectID'] != WCF::getUser()->userID) {
-                       $owner = CommentDataHandler::getInstance()->getUser($this->additionalData['objectID']);
+                       $owner = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
                }
                
                if ($count > 1) {
-                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.message.stacked', array(
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.message.stacked', [
                                'author' => $this->author,
                                'authors' => $authors,
                                'count' => $count,
                                'others' => $count - 1,
                                'owner' => $owner
-                       ));
+                       ]);
                }
                
-               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.message', array(
+               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.message', [
                        'author' => $this->author,
                        'owner' => $owner
-               ));
+               ]);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
+        * @inheritDoc
         */
-       public function getEmailMessage($notificationType = 'instant') { /* not supported */ }
+       public function getEmailMessage($notificationType = 'instant') {
+               // not supported
+       }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
+        * @inheritDoc
         */
        public function getLink() {
                $owner = WCF::getUser();
                if ($this->additionalData['objectID'] != WCF::getUser()->userID) {
-                       $owner = CommentDataHandler::getInstance()->getUser($this->additionalData['objectID']);
+                       $owner = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
                }
                
-               return LinkHandler::getInstance()->getLink('User', array(
-                       'object' => $owner
-               ), '#wall');
+               return LinkHandler::getInstance()->getLink('User', ['object' => $owner], '#wall');
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
+        * @inheritDoc
         */
        public function getEventHash() {
                return sha1($this->eventID . '-' . $this->additionalData['objectID']);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::supportsEmailNotification()
+        * @inheritDoc
         */
        public function supportsEmailNotification() {
                return false;
index aa25716ddbe9c2dc4d82eec2cf31b4fd3832631e..980375f15fd2bf0f9f7e6b660420a686ad934127 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 namespace wcf\system\user\notification\event;
-use wcf\system\comment\CommentDataHandler;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 
@@ -8,7 +8,7 @@ use wcf\system\WCF;
  * User notification event for profile commment response likes.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.user.notification.event
@@ -16,92 +16,92 @@ use wcf\system\WCF;
  */
 class UserProfileCommentResponseLikeUserNotificationEvent extends AbstractSharedUserNotificationEvent {
        /**
-        * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
+        * @inheritDoc
         */
        protected $stackable = true;
        
        /**
-        * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::prepare()
+        * @inheritDoc
         */
        protected function prepare() {
-               CommentDataHandler::getInstance()->cacheUserID($this->additionalData['objectID']);
-               CommentDataHandler::getInstance()->cacheUserID($this->additionalData['commentUserID']);
+               UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['objectID']);
+               UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['commentUserID']);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
+        * @inheritDoc
         */
        public function getTitle() {
                $count = count($this->getAuthors());
                if ($count > 1) {
-                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.title.stacked', array(
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.title.stacked', [
                                'count' => $count,
                                'timesTriggered' => $this->notification->timesTriggered
-                       ));
+                       ]);
                }
                
                return $this->getLanguage()->get('wcf.user.notification.commentResponse.like.title');
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
+        * @inheritDoc
         */
        public function getMessage() {
                $authors = array_values($this->getAuthors());
                $count = count($authors);
                $commentUser = $owner = null;
                if ($this->additionalData['objectID'] != WCF::getUser()->userID) {
-                       $owner = CommentDataHandler::getInstance()->getUser($this->additionalData['objectID']);
+                       $owner = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
                }
                if ($this->additionalData['commentUserID'] != WCF::getUser()->userID) {
-                       $commentUser = CommentDataHandler::getInstance()->getUser($this->additionalData['commentUserID']);
+                       $commentUser = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['commentUserID']);
                }
                
                if ($count > 1) {
-                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.message.stacked', array(
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.message.stacked', [
                                'author' => $this->author,
                                'authors' => $authors,
                                'commentUser' => $commentUser,
                                'count' => $count,
                                'others' => $count - 1,
                                'owner' => $owner
-                       ));
+                       ]);
                }
                
-               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.message', array(
+               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.message', [
                        'author' => $this->author,
                        'owner' => $owner
-               ));
+               ]);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
+        * @inheritDoc
         */
-       public function getEmailMessage($notificationType = 'instant') { /* not supported */ }
+       public function getEmailMessage($notificationType = 'instant') {
+               // not supported
+       }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
+        * @inheritDoc
         */
        public function getLink() {
                $owner = WCF::getUser();
                if ($this->additionalData['objectID'] != WCF::getUser()->userID) {
-                       $owner = CommentDataHandler::getInstance()->getUser($this->additionalData['objectID']);
+                       $owner = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
                }
                
-               return LinkHandler::getInstance()->getLink('User', array(
-                       'object' => $owner
-               ), '#wall');
+               return LinkHandler::getInstance()->getLink('User', ['object' => $owner], '#wall');
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
+        * @inheritDoc
         */
        public function getEventHash() {
                return sha1($this->eventID . '-' . $this->additionalData['commentID']);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::supportsEmailNotification()
+        * @inheritDoc
         */
        public function supportsEmailNotification() {
                return false;
index 2871ee23d1839dec0a40bad67aef8a48a4f0b59d..da1c68cfeeed6a852dc4383d5832886a7cdf952f 100644 (file)
@@ -2,7 +2,9 @@
 namespace wcf\system\user\notification\event;
 use wcf\data\comment\Comment;
 use wcf\data\user\User;
-use wcf\system\comment\CommentDataHandler;
+use wcf\data\user\UserProfile;
+use wcf\system\cache\runtime\CommentRuntimeCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 
@@ -10,7 +12,7 @@ use wcf\system\WCF;
  * User notification event for profile's owner for commment responses.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.user.notification.event
@@ -18,45 +20,45 @@ use wcf\system\WCF;
  */
 class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractSharedUserNotificationEvent {
        /**
-        * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
+        * @inheritDoc
         */
        protected $stackable = true;
        
        /**
-        * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::prepare()
+        * @inheritDoc
         */
        protected function prepare() {
-               CommentDataHandler::getInstance()->cacheCommentID($this->userNotificationObject->commentID);
-               CommentDataHandler::getInstance()->cacheUserID($this->additionalData['userID']);
+               CommentRuntimeCache::getInstance()->cacheObjectID($this->userNotificationObject->commentID);
+               UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['userID']);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
+        * @inheritDoc
         */
        public function getTitle() {
                $count = count($this->getAuthors());
                if ($count > 1) {
-                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.title.stacked', array(
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.title.stacked', [
                                'count' => $count,
                                'timesTriggered' => $this->notification->timesTriggered
-                       ));
+                       ]);
                }
                
                return $this->getLanguage()->get('wcf.user.notification.commentResponseOwner.title');
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
+        * @inheritDoc
         */
        public function getMessage() {
-               $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
+               $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID);
                if ($comment->userID) {
-                       $commentAuthor = CommentDataHandler::getInstance()->getUser($comment->userID);
+                       $commentAuthor = UserProfileRuntimeCache::getInstance()->getObject($comment->userID);
                }
                else {
-                       $commentAuthor = new User(null, array(
+                       $commentAuthor = new UserProfile(new User(null, [
                                'username' => $comment->username
-                       ));
+                       ]));
                }
                
                $authors = $this->getAuthors();
@@ -66,23 +68,23 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractShare
                        }
                        $count = count($authors);
                        
-                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.message.stacked', array(
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.message.stacked', [
                                'author' => $commentAuthor,
                                'authors' => array_values($authors),
                                'count' => $count,
                                'others' => $count - 1,
                                'guestTimesTriggered' => $this->notification->guestTimesTriggered
-                       ));
+                       ]);
                }
                
-               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.message', array(
+               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.message', [
                        'author' => $this->author,
                        'commentAuthor' => $commentAuthor
-               ));
+               ]);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
+        * @inheritDoc
         */
        public function getEmailMessage($notificationType = 'instant') {
                $comment = new Comment($this->userNotificationObject->commentID);
@@ -91,9 +93,9 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractShare
                        $commentAuthor = new User($comment->userID);
                }
                else {
-                       $commentAuthor = new User(null, array(
+                       $commentAuthor = new User(null, [
                                'username' => $comment->username
-                       ));
+                       ]);
                }
                
                $authors = $this->getAuthors();
@@ -103,7 +105,7 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractShare
                        }
                        $count = count($authors);
                        
-                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.mail.stacked', array(
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.mail.stacked', [
                                'author' => $this->author,
                                'authors' => array_values($authors),
                                'commentAuthor' => $commentAuthor,
@@ -113,27 +115,27 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractShare
                                'owner' => $owner,
                                'response' => $this->userNotificationObject,
                                'guestTimesTriggered' => $this->notification->guestTimesTriggered
-                       ));
+                       ]);
                }
                
-               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.mail', array(
+               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.mail', [
                        'response' => $this->userNotificationObject,
                        'author' => $this->author,
                        'commentAuthor' => $commentAuthor,
                        'owner' => $owner,
                        'notificationType' => $notificationType
-               ));
+               ]);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
+        * @inheritDoc
         */
        public function getLink() {
-               return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall');
+               return LinkHandler::getInstance()->getLink('User', ['object' => WCF::getUser()], '#wall');
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
+        * @inheritDoc
         */
        public function getEventHash() {
                return sha1($this->eventID . '-' . $this->userNotificationObject->commentID);
index 82da3bb3da08c0bff381b371020c349ea1c85730..1a60438544815852361fd352a66d415baec75f5f 100644 (file)
@@ -1,13 +1,14 @@
 <?php
 namespace wcf\system\user\notification\event;
-use wcf\system\comment\CommentDataHandler;
+use wcf\system\cache\runtime\CommentRuntimeCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\request\LinkHandler;
 
 /**
  * User notification event for profile commment responses.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.user.notification.event
@@ -15,40 +16,40 @@ use wcf\system\request\LinkHandler;
  */
 class UserProfileCommentResponseUserNotificationEvent extends AbstractSharedUserNotificationEvent {
        /**
-        * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
+        * @inheritDoc
         */
        protected $stackable = true;
        
        /**
-        * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::prepare()
+        * @inheritDoc
         */
        protected function prepare() {
-               CommentDataHandler::getInstance()->cacheCommentID($this->userNotificationObject->commentID);
-               CommentDataHandler::getInstance()->cacheUserID($this->additionalData['objectID']);
-               CommentDataHandler::getInstance()->cacheUserID($this->additionalData['userID']);
+               CommentRuntimeCache::getInstance()->cacheObjectID($this->userNotificationObject->commentID);
+               UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['objectID']);
+               UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['userID']);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
+        * @inheritDoc
         */
        public function getTitle() {
                $count = count($this->getAuthors());
                if ($count > 1) {
-                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.title.stacked', array(
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.title.stacked', [
                                'count' => $count,
                                'timesTriggered' => $this->notification->timesTriggered
-                       ));
+                       ]);
                }
                
                return $this->getLanguage()->get('wcf.user.notification.commentResponse.title');
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
+        * @inheritDoc
         */
        public function getMessage() {
-               $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
-               $owner = CommentDataHandler::getInstance()->getUser($comment->objectID);
+               $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID);
+               $owner = UserProfileRuntimeCache::getInstance()->getObject($comment->objectID);
                
                $authors = $this->getAuthors();
                if (count($authors) > 1) {
@@ -57,27 +58,27 @@ class UserProfileCommentResponseUserNotificationEvent extends AbstractSharedUser
                        }
                        $count = count($authors);
                        
-                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message.stacked', array(
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message.stacked', [
                                'authors' => array_values($authors),
                                'count' => $count,
                                'others' => $count - 1,
                                'owner' => $owner,
                                'guestTimesTriggered' => $this->notification->guestTimesTriggered
-                       ));
+                       ]);
                }
                
-               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message', array(
+               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message', [
                        'author' => $this->author,
                        'owner' => $owner
-               ));
+               ]);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
+        * @inheritDoc
         */
        public function getEmailMessage($notificationType = 'instant') {
-               $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
-               $owner = CommentDataHandler::getInstance()->getUser($comment->objectID);
+               $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID);
+               $owner = UserProfileRuntimeCache::getInstance()->getObject($comment->objectID);
                
                $authors = $this->getAuthors();
                if (count($authors) > 1) {
@@ -86,7 +87,7 @@ class UserProfileCommentResponseUserNotificationEvent extends AbstractSharedUser
                        }
                        $count = count($authors);
                        
-                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.mail.stacked', array(
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.mail.stacked', [
                                'author' => $this->author,
                                'authors' => array_values($authors),
                                'count' => $count,
@@ -95,29 +96,29 @@ class UserProfileCommentResponseUserNotificationEvent extends AbstractSharedUser
                                'owner' => $owner,
                                'response' => $this->userNotificationObject,
                                'guestTimesTriggered' => $this->notification->guestTimesTriggered
-                       ));
+                       ]);
                }
                
-               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.mail', array(
+               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.mail', [
                        'response' => $this->userNotificationObject,
                        'author' => $this->author,
                        'owner' => $owner,
                        'notificationType' => $notificationType
-               ));
+               ]);
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
+        * @inheritDoc
         */
        public function getLink() {
-               $comment = CommentDataHandler::getInstance()->getComment($this->userNotificationObject->commentID);
-               $user = CommentDataHandler::getInstance()->getUser($comment->objectID);
+               $comment = CommentRuntimeCache::getInstance()->getObject($this->userNotificationObject->commentID);
+               $user = UserProfileRuntimeCache::getInstance()->getObject($comment->objectID);
                
-               return LinkHandler::getInstance()->getLink('User', array('object' => $user), '#wall');
+               return LinkHandler::getInstance()->getLink('User', ['object' => $user], '#wall');
        }
        
        /**
-        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
+        * @inheritDoc
         */
        public function getEventHash() {
                return sha1($this->eventID . '-' . $this->userNotificationObject->commentID);
index 9500f589180a043e2547e41e2dbfde7bf9f5d750..884dc21266956dc4830a1bd08b58469daa5ed5f9 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\system\user\notification\object\type;
 use wcf\data\comment\Comment;
 use wcf\data\user\UserProfile;
-use wcf\data\user\UserProfileCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\comment\CommentHandler;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\user\storage\UserStorageHandler;
@@ -89,7 +89,7 @@ trait TMultiRecipientModerationQueueCommentUserNotificationObjectType {
                        // make sure that all users (still) have permission to access moderation
                        if (!$recipientIDs) {
                                UserStorageHandler::getInstance()->loadStorage($recipientIDs);
-                               $userProfiles = UserProfileCache::getInstance()->getUserProfiles($recipientIDs);
+                               $userProfiles = UserProfileRuntimeCache::getInstance()->getObjects($recipientIDs);
                                $recipientIDs = array_keys(array_filter($userProfiles, function(UserProfile $userProfile) {
                                        return $userProfile->getPermission('mod.general.canUseModeration');
                                }));