From a8c5936e0762a8305d96ea7d64a3268c6427bb77 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 7 Apr 2016 10:45:06 +0200 Subject: [PATCH] Replace calls of deprecated method --- .../install/files/lib/data/user/UserProfileAction.class.php | 5 +++-- .../files/lib/data/user/avatar/UserAvatarAction.class.php | 4 ++-- .../files/lib/data/user/follow/UserFollowAction.class.php | 5 +++-- .../lib/data/user/follow/UserFollowingAction.class.php | 4 ++-- .../files/lib/data/user/ignore/UserIgnoreAction.class.php | 6 +++--- .../user/profile/visitor/UserProfileVisitorAction.class.php | 5 +++-- wcfsetup/install/files/lib/form/MailForm.class.php | 5 +++-- wcfsetup/install/files/lib/page/UserPage.class.php | 5 +++-- .../comment/manager/UserProfileCommentManager.class.php | 6 +++--- .../system/cronjob/DailyMailNotificationCronjob.class.php | 3 ++- .../message/quote/AbstractMessageQuoteHandler.class.php | 4 ++-- .../user/notification/UserNotificationHandler.class.php | 3 ++- 12 files changed, 31 insertions(+), 24 deletions(-) diff --git a/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php b/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php index bfc50b6373..55bd29005f 100644 --- a/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php @@ -3,6 +3,7 @@ namespace wcf\data\user; use wcf\data\object\type\ObjectTypeCache; use wcf\system\bbcode\BBCodeParser; use wcf\system\bbcode\MessageParser; +use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\PermissionDeniedException; use wcf\system\exception\UserInputException; @@ -127,7 +128,7 @@ class UserProfileAction extends UserAction { if (count($this->objectIDs) != 1) { throw new UserInputException('objectIDs'); } - $this->userProfile = UserProfile::getUserProfile(reset($this->objectIDs)); + $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject(reset($this->objectIDs)); if ($this->userProfile === null) { throw new UserInputException('objectIDs'); @@ -175,7 +176,7 @@ class UserProfileAction extends UserAction { public function validateBeginEdit() { if (!empty($this->objectIDs) && count($this->objectIDs) == 1) { $userID = reset($this->objectIDs); - $this->userProfile = UserProfile::getUserProfile($userID); + $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($userID); } if ($this->userProfile === null || !$this->userProfile->userID) { diff --git a/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php b/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php index d134de5b5e..36f18e15f3 100644 --- a/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php +++ b/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php @@ -2,8 +2,8 @@ namespace wcf\data\user\avatar; use wcf\data\user\User; use wcf\data\user\UserEditor; -use wcf\data\user\UserProfile; use wcf\data\AbstractDatabaseObjectAction; +use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\exception\IllegalLinkException; use wcf\system\exception\PermissionDeniedException; use wcf\system\exception\SystemException; @@ -340,7 +340,7 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { throw new PermissionDeniedException(); } - if (!WCF::getSession()->getPermission('user.profile.avatar.canUploadAvatar') || UserProfile::getUserProfile($this->avatar->userID)->disableAvatar) { + if (!WCF::getSession()->getPermission('user.profile.avatar.canUploadAvatar') || UserProfileRuntimeCache::getInstance()->getObject($this->avatar->userID)->disableAvatar) { throw new PermissionDeniedException(); } diff --git a/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php b/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php index 1a6cc07dcf..574952e213 100644 --- a/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php +++ b/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php @@ -3,6 +3,7 @@ namespace wcf\data\user\follow; use wcf\data\user\UserProfile; use wcf\data\AbstractDatabaseObjectAction; use wcf\data\IGroupedUserListAction; +use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\exception\PermissionDeniedException; use wcf\system\exception\UserInputException; use wcf\system\user\activity\event\UserActivityEventHandler; @@ -30,7 +31,7 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU /** * user profile object - * @var \wcf\data\user\UserProfile; + * @var UserProfile; */ public $userProfile = null; @@ -158,7 +159,7 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU $this->readInteger('pageNo'); $this->readInteger('userID'); - $this->userProfile = UserProfile::getUserProfile($this->parameters['userID']); + $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->parameters['userID']); if ($this->userProfile->isProtected()) { throw new PermissionDeniedException(); } diff --git a/wcfsetup/install/files/lib/data/user/follow/UserFollowingAction.class.php b/wcfsetup/install/files/lib/data/user/follow/UserFollowingAction.class.php index 768caa8897..79c4726578 100644 --- a/wcfsetup/install/files/lib/data/user/follow/UserFollowingAction.class.php +++ b/wcfsetup/install/files/lib/data/user/follow/UserFollowingAction.class.php @@ -1,6 +1,6 @@ readInteger('pageNo'); $this->readInteger('userID'); - $this->userProfile = UserProfile::getUserProfile($this->parameters['userID']); + $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->parameters['userID']); if ($this->userProfile->isProtected()) { throw new PermissionDeniedException(); } diff --git a/wcfsetup/install/files/lib/data/user/ignore/UserIgnoreAction.class.php b/wcfsetup/install/files/lib/data/user/ignore/UserIgnoreAction.class.php index 7079d851d2..f3fc8f0841 100644 --- a/wcfsetup/install/files/lib/data/user/ignore/UserIgnoreAction.class.php +++ b/wcfsetup/install/files/lib/data/user/ignore/UserIgnoreAction.class.php @@ -1,7 +1,7 @@ readInteger('ignoreUserID', false, 'data'); - $userProfile = UserProfile::getUserProfile($this->parameters['data']['ignoreUserID']); + $userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->parameters['data']['ignoreUserID']); if ($userProfile === null || $userProfile->userID == WCF::getUser()->userID) { throw new IllegalLinkException(); } @@ -63,7 +63,7 @@ class UserIgnoreAction extends AbstractDatabaseObjectAction { public function validateUnignore() { $this->readInteger('ignoreUserID', false, 'data'); - $userProfile = UserProfile::getUserProfile($this->parameters['data']['ignoreUserID']); + $userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->parameters['data']['ignoreUserID']); if ($userProfile === null) { throw new IllegalLinkException(); } diff --git a/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitorAction.class.php b/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitorAction.class.php index 811062be02..df6e3a76a0 100644 --- a/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitorAction.class.php +++ b/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitorAction.class.php @@ -3,6 +3,7 @@ namespace wcf\data\user\profile\visitor; use wcf\data\user\UserProfile; use wcf\data\AbstractDatabaseObjectAction; use wcf\data\IGroupedUserListAction; +use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\exception\PermissionDeniedException; use wcf\system\user\GroupedUserList; use wcf\system\WCF; @@ -25,7 +26,7 @@ class UserProfileVisitorAction extends AbstractDatabaseObjectAction implements I /** * user profile object - * @var \wcf\data\user\UserProfile; + * @var UserProfile; */ public $userProfile = null; @@ -36,7 +37,7 @@ class UserProfileVisitorAction extends AbstractDatabaseObjectAction implements I $this->readInteger('pageNo'); $this->readInteger('userID'); - $this->userProfile = UserProfile::getUserProfile($this->parameters['userID']); + $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->parameters['userID']); if ($this->userProfile->isProtected()) { throw new PermissionDeniedException(); } diff --git a/wcfsetup/install/files/lib/form/MailForm.class.php b/wcfsetup/install/files/lib/form/MailForm.class.php index d512e28815..a9a31baa44 100644 --- a/wcfsetup/install/files/lib/form/MailForm.class.php +++ b/wcfsetup/install/files/lib/form/MailForm.class.php @@ -1,6 +1,7 @@ userID = intval($_REQUEST['id']); - $this->user = UserProfile::getUserProfile($this->userID); + $this->user = UserProfileRuntimeCache::getInstance()->getObject($this->userID); if ($this->user === null) { throw new IllegalLinkException(); } diff --git a/wcfsetup/install/files/lib/page/UserPage.class.php b/wcfsetup/install/files/lib/page/UserPage.class.php index 49c7ab034c..9eb871443e 100644 --- a/wcfsetup/install/files/lib/page/UserPage.class.php +++ b/wcfsetup/install/files/lib/page/UserPage.class.php @@ -10,6 +10,7 @@ use wcf\data\user\profile\visitor\UserProfileVisitorList; use wcf\data\user\UserEditor; use wcf\data\user\UserProfile; use wcf\system\breadcrumb\Breadcrumb; +use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\exception\IllegalLinkException; use wcf\system\exception\PermissionDeniedException; use wcf\system\menu\user\profile\UserProfileMenu; @@ -59,7 +60,7 @@ class UserPage extends AbstractPage { /** * user object - * @var \wcf\data\user\UserProfile + * @var UserProfile */ public $user = null; @@ -88,7 +89,7 @@ class UserPage extends AbstractPage { parent::readParameters(); if (isset($_REQUEST['id'])) $this->userID = intval($_REQUEST['id']); - $this->user = UserProfile::getUserProfile($this->userID); + $this->user = UserProfileRuntimeCache::getInstance()->getObject($this->userID); if ($this->user === null) { throw new IllegalLinkException(); } diff --git a/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php b/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php index 54910c7617..43e7b1f634 100644 --- a/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php +++ b/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php @@ -5,7 +5,7 @@ use wcf\data\comment\response\CommentResponseList; use wcf\data\comment\Comment; use wcf\data\comment\CommentList; use wcf\data\object\type\ObjectTypeCache; -use wcf\data\user\UserProfile; +use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\like\IViewableLikeProvider; use wcf\system\request\LinkHandler; use wcf\system\WCF; @@ -56,7 +56,7 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa */ public function isAccessible($objectID, $validateWritePermission = false) { // check object id - $userProfile = UserProfile::getUserProfile($objectID); + $userProfile = UserProfileRuntimeCache::getInstance()->getObject($objectID); if ($userProfile === null) { return false; } @@ -176,7 +176,7 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa } } if (!empty($userIDs)) { - $users = UserProfile::getUserProfiles(array_unique($userIDs)); + $users = UserProfileRuntimeCache::getInstance()->getObjects(array_unique($userIDs)); } // set message diff --git a/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php index d0fdf97487..8193471d02 100644 --- a/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php @@ -7,6 +7,7 @@ use wcf\data\user\User; use wcf\data\user\UserEditor; use wcf\data\user\UserList; use wcf\data\user\UserProfile; +use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\mail\Mail; use wcf\system\user\notification\UserNotificationHandler; @@ -126,7 +127,7 @@ class DailyMailNotificationCronjob extends AbstractCronjob { } // load authors - $authors = UserProfile::getUserProfiles($authorIDs); + $authors = UserProfileRuntimeCache::getInstance()->getObjects($authorIDs); $unknownAuthor = new UserProfile(new User(null, array('userID' => null, 'username' => WCF::getLanguage()->get('wcf.user.guest')))); // load objects associated with each object type diff --git a/wcfsetup/install/files/lib/system/message/quote/AbstractMessageQuoteHandler.class.php b/wcfsetup/install/files/lib/system/message/quote/AbstractMessageQuoteHandler.class.php index 5a738a8046..bdefc4bc03 100644 --- a/wcfsetup/install/files/lib/system/message/quote/AbstractMessageQuoteHandler.class.php +++ b/wcfsetup/install/files/lib/system/message/quote/AbstractMessageQuoteHandler.class.php @@ -1,6 +1,6 @@ getObjects($userIDs); } WCF::getTPL()->assign(array( diff --git a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php index 14695027a9..4729c6fa48 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -10,6 +10,7 @@ use wcf\data\user\User; use wcf\data\user\UserEditor; use wcf\data\user\UserProfile; use wcf\system\cache\builder\UserNotificationEventCacheBuilder; +use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\event\EventHandler; use wcf\system\exception\SystemException; @@ -99,7 +100,7 @@ class UserNotificationHandler extends SingletonFactory { $userProfile = new UserProfile(WCF::getUser()); } else { - $userProfile = UserProfile::getUserProfile($notificationObject->getAuthorID()); + $userProfile = UserProfileRuntimeCache::getInstance()->getObject($notificationObject->getAuthorID()); } } if ($userProfile === null) { -- 2.20.1