From: Matthias Schmidt Date: Fri, 27 May 2016 06:54:20 +0000 (+0200) Subject: Use AbstractDatabaseObjectAction::getObjects() X-Git-Tag: 3.0.0_Beta_1~1610 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4a130a510ce8e643eb0526fb5ede2d9285f9a5a3;p=GitHub%2FWoltLab%2FWCF.git Use AbstractDatabaseObjectAction::getObjects() … so that IDE can property determine the type of the objects as the return value type of `getObjects()` is specified by `@method` tags. --- diff --git a/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php b/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php index a7fe5f7a0e..406feb4a5b 100644 --- a/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php +++ b/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php @@ -249,7 +249,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID // update object IDs $this->objectIDs = []; - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { $this->objectIDs[] = $object->getObjectID(); } } @@ -348,7 +348,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID // get ids $objectIDs = []; - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { $objectIDs[] = $object->getObjectID(); } @@ -365,13 +365,13 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID } if (isset($this->parameters['data'])) { - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { $object->update($this->parameters['data']); } } if (isset($this->parameters['counters'])) { - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { $object->updateCounters($this->parameters['counters']); } } diff --git a/wcfsetup/install/files/lib/data/ad/AdAction.class.php b/wcfsetup/install/files/lib/data/ad/AdAction.class.php index b5d3823f61..913bbfab66 100644 --- a/wcfsetup/install/files/lib/data/ad/AdAction.class.php +++ b/wcfsetup/install/files/lib/data/ad/AdAction.class.php @@ -68,7 +68,7 @@ class AdAction extends AbstractDatabaseObjectAction implements ISortableAction, * @inheritDoc */ public function toggle() { - foreach ($this->objects as $ad) { + foreach ($this->getObjects() as $ad) { $ad->update([ 'isDisabled' => $ad->isDisabled ? 0 : 1 ]); diff --git a/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php b/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php index ad933eb8b7..1644a8cf10 100644 --- a/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php +++ b/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php @@ -51,7 +51,7 @@ class ApplicationAction extends AbstractDatabaseObjectAction { // calculate cookie path $domains = []; $regex = new Regex(':[0-9]+'); - foreach ($this->objects as $application) { + foreach ($this->getObjects() as $application) { $domainName = $application->domainName; if (StringUtil::endsWith($regex->replace($domainName, ''), $application->cookieDomain)) { $domainName = $application->cookieDomain; diff --git a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php index 09d534e214..67aaa9afc9 100644 --- a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php +++ b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php @@ -66,7 +66,7 @@ class AttachmentAction extends AbstractDatabaseObjectAction implements ISortable } } - foreach ($this->objects as $attachment) { + foreach ($this->getObjects() as $attachment) { if ($attachment->tmpHash) { if ($attachment->userID != WCF::getUser()->userID) { throw new PermissionDeniedException(); @@ -198,7 +198,7 @@ class AttachmentAction extends AbstractDatabaseObjectAction implements ISortable $saveStrategy = new DefaultUploadFileSaveStrategy(self::class); - foreach ($this->objects as $attachment) { + foreach ($this->getObjects() as $attachment) { if (!$attachment->isImage) { // create thumbnails for every file that isn't an image $this->eventAttachment = $attachment; diff --git a/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php b/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php index 5ce1d7f75b..ffeab34a87 100644 --- a/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php +++ b/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php @@ -106,7 +106,7 @@ class BBCodeAction extends AbstractDatabaseObjectAction implements IToggleAction public function validateDelete() { parent::validateDelete(); - foreach ($this->objects as $bbcode) { + foreach ($this->getObjects() as $bbcode) { if (!$bbcode->canDelete()) { throw new PermissionDeniedException(); } @@ -124,7 +124,7 @@ class BBCodeAction extends AbstractDatabaseObjectAction implements IToggleAction * @inheritDoc */ public function toggle() { - foreach ($this->objects as $bbcode) { + foreach ($this->getObjects() as $bbcode) { $bbcode->update([ 'isDisabled' => $bbcode->isDisabled ? 0 : 1 ]); diff --git a/wcfsetup/install/files/lib/data/box/BoxAction.class.php b/wcfsetup/install/files/lib/data/box/BoxAction.class.php index 48b53e3f16..ba4d70e937 100644 --- a/wcfsetup/install/files/lib/data/box/BoxAction.class.php +++ b/wcfsetup/install/files/lib/data/box/BoxAction.class.php @@ -125,7 +125,7 @@ class BoxAction extends AbstractDatabaseObjectAction { VALUES (?, ?, ?, ?, ?)"; $insertStatement = WCF::getDB()->prepareStatement($sql); - foreach ($this->objects as $box) { + foreach ($this->getObjects() as $box) { $deleteStatement->execute([$box->boxID]); foreach ($this->parameters['content'] as $languageID => $content) { @@ -158,7 +158,7 @@ class BoxAction extends AbstractDatabaseObjectAction { VALUES (?, ?, ?)"; $insertStatement = WCF::getDB()->prepareStatement($sql); - foreach ($this->objects as $box) { + foreach ($this->getObjects() as $box) { $deleteStatement->execute([$box->boxID]); $visibleEverywhere = (isset($this->parameters['data']['visibleEverywhere']) ? $this->parameters['data']['visibleEverywhere'] : $box->visibleEverywhere); @@ -175,7 +175,7 @@ class BoxAction extends AbstractDatabaseObjectAction { public function validateDelete() { parent::validateDelete(); - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { if (!$object->canDelete()) { throw new PermissionDeniedException(); } @@ -186,7 +186,7 @@ class BoxAction extends AbstractDatabaseObjectAction { * @inheritDoc */ public function delete() { - foreach ($this->objects as $box) { + foreach ($this->getObjects() as $box) { if ($box->boxType == 'tpl') { foreach ($box->getBoxContent() as $languageID => $content) { $file = WCF_DIR . 'templates/' . $box->getTplName(($languageID ?: null)) . '.tpl'; diff --git a/wcfsetup/install/files/lib/data/captcha/question/CaptchaQuestionAction.class.php b/wcfsetup/install/files/lib/data/captcha/question/CaptchaQuestionAction.class.php index bf0e833eca..2f968e0b9b 100644 --- a/wcfsetup/install/files/lib/data/captcha/question/CaptchaQuestionAction.class.php +++ b/wcfsetup/install/files/lib/data/captcha/question/CaptchaQuestionAction.class.php @@ -32,7 +32,7 @@ class CaptchaQuestionAction extends AbstractDatabaseObjectAction implements ITog * @inheritDoc */ public function toggle() { - foreach ($this->objects as $question) { + foreach ($this->getObjects() as $question) { $question->update([ 'isDisabled' => $question->isDisabled ? 0 : 1 ]); diff --git a/wcfsetup/install/files/lib/data/category/CategoryAction.class.php b/wcfsetup/install/files/lib/data/category/CategoryAction.class.php index 0bc6fa6b90..fdce42714b 100644 --- a/wcfsetup/install/files/lib/data/category/CategoryAction.class.php +++ b/wcfsetup/install/files/lib/data/category/CategoryAction.class.php @@ -44,7 +44,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc $returnValue = parent::delete(); // call category types - foreach ($this->objects as $categoryEditor) { + foreach ($this->getObjects() as $categoryEditor) { $categoryEditor->getProcessor()->afterDeletion($categoryEditor); } @@ -55,7 +55,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc * @inheritDoc */ public function toggle() { - foreach ($this->objects as $categoryEditor) { + foreach ($this->getObjects() as $categoryEditor) { $categoryEditor->update([ 'isDisabled' => 1 - $categoryEditor->isDisabled ]); @@ -100,7 +100,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc $objectType = null; $parentUpdates = []; - foreach ($this->objects as $category) { + foreach ($this->getObjects() as $category) { if ($objectType === null) { $objectType = $category->getObjectType(); } @@ -183,7 +183,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc } } - foreach ($this->objects as $categoryEditor) { + foreach ($this->getObjects() as $categoryEditor) { if (!$categoryEditor->getProcessor()->canDeleteCategory()) { throw new PermissionDeniedException(); } @@ -217,7 +217,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc } } - foreach ($this->objects as $categoryEditor) { + foreach ($this->getObjects() as $categoryEditor) { if (!$categoryEditor->getProcessor()->canEditCategory()) { throw new PermissionDeniedException(); } diff --git a/wcfsetup/install/files/lib/data/comment/CommentAction.class.php b/wcfsetup/install/files/lib/data/comment/CommentAction.class.php index 790599f14e..2185311d20 100644 --- a/wcfsetup/install/files/lib/data/comment/CommentAction.class.php +++ b/wcfsetup/install/files/lib/data/comment/CommentAction.class.php @@ -102,7 +102,7 @@ class CommentAction extends AbstractDatabaseObjectAction { // update counters $processors = []; $groupCommentIDs = $commentIDs = []; - foreach ($this->objects as $comment) { + foreach ($this->getObjects() as $comment) { if (!isset($processors[$comment->objectTypeID])) { $objectType = ObjectTypeCache::getInstance()->getObjectType($comment->objectTypeID); $processors[$comment->objectTypeID] = $objectType->getProcessor(); diff --git a/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php b/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php index b984c6b4dd..1f135ba97f 100644 --- a/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php +++ b/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php @@ -65,7 +65,7 @@ class CommentResponseAction extends AbstractDatabaseObjectAction { // read object type ids for comments $commentIDs = []; - foreach ($this->objects as $response) { + foreach ($this->getObjects() as $response) { $commentIDs[] = $response->commentID; } @@ -76,7 +76,7 @@ class CommentResponseAction extends AbstractDatabaseObjectAction { // update counters $processors = $responseIDs = $updateComments = []; - foreach ($this->objects as $response) { + foreach ($this->getObjects() as $response) { $objectTypeID = $comments[$response->commentID]->objectTypeID; if (!isset($processors[$objectTypeID])) { diff --git a/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php b/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php index 07446cde4a..4c0b274fde 100644 --- a/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php +++ b/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php @@ -60,7 +60,7 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio public function validateDelete() { parent::validateDelete(); - foreach ($this->objects as $cronjob) { + foreach ($this->getObjects() as $cronjob) { if (!$cronjob->isDeletable()) { throw new PermissionDeniedException(); } @@ -73,7 +73,7 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio public function validateUpdate() { parent::validateUpdate(); - foreach ($this->objects as $cronjob) { + foreach ($this->getObjects() as $cronjob) { if (!$cronjob->isEditable()) { throw new PermissionDeniedException(); } @@ -86,7 +86,7 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio public function validateToggle() { parent::validateUpdate(); - foreach ($this->objects as $cronjob) { + foreach ($this->getObjects() as $cronjob) { if (!$cronjob->canBeDisabled()) { throw new PermissionDeniedException(); } @@ -97,7 +97,7 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio * @inheritDoc */ public function toggle() { - foreach ($this->objects as $cronjob) { + foreach ($this->getObjects() as $cronjob) { $cronjob->update([ 'isDisabled' => $cronjob->isDisabled ? 0 : 1 ]); @@ -117,12 +117,12 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio public function execute() { $return = []; - foreach ($this->objects as $key => $cronjob) { + foreach ($this->getObjects() as $key => $cronjob) { // mark them as pending $cronjob->update(['state' => Cronjob::PENDING]); } - foreach ($this->objects as $cronjob) { + foreach ($this->getObjects() as $cronjob) { // it now time for executing $cronjob->update(['state' => Cronjob::EXECUTING]); $className = $cronjob->className; diff --git a/wcfsetup/install/files/lib/data/label/LabelAction.class.php b/wcfsetup/install/files/lib/data/label/LabelAction.class.php index ab7860add1..4dac5e79fb 100644 --- a/wcfsetup/install/files/lib/data/label/LabelAction.class.php +++ b/wcfsetup/install/files/lib/data/label/LabelAction.class.php @@ -89,7 +89,7 @@ class LabelAction extends AbstractDatabaseObjectAction implements ISortableActio if (!empty($this->objects)) { // identify i18n labels $languageVariables = []; - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { if (preg_match('~wcf.acp.label.label\d+~', $object->label)) { $languageVariables[] = $object->label; } diff --git a/wcfsetup/install/files/lib/data/language/LanguageAction.class.php b/wcfsetup/install/files/lib/data/language/LanguageAction.class.php index 72a443f81c..7f445e4c26 100644 --- a/wcfsetup/install/files/lib/data/language/LanguageAction.class.php +++ b/wcfsetup/install/files/lib/data/language/LanguageAction.class.php @@ -72,7 +72,7 @@ class LanguageAction extends AbstractDatabaseObjectAction implements IToggleActi public function validateToggle() { parent::validateUpdate(); - foreach ($this->objects as $language) { + foreach ($this->getObjects() as $language) { if ($language->isDefault) { throw new UserInputException('objectIDs'); } @@ -83,7 +83,7 @@ class LanguageAction extends AbstractDatabaseObjectAction implements IToggleActi * @inheritdoc */ public function toggle() { - foreach ($this->objects as $language) { + foreach ($this->getObjects() as $language) { $isDisabled = ($language->isDisabled) ? 0 : 1; $language->update(['isDisabled' => $isDisabled]); } diff --git a/wcfsetup/install/files/lib/data/media/MediaAction.class.php b/wcfsetup/install/files/lib/data/media/MediaAction.class.php index dec6f43f8f..d81a1c1af2 100644 --- a/wcfsetup/install/files/lib/data/media/MediaAction.class.php +++ b/wcfsetup/install/files/lib/data/media/MediaAction.class.php @@ -442,8 +442,7 @@ class MediaAction extends AbstractDatabaseObjectAction implements ISearchAction, $this->readObjects(); } - /** @var MediaEditor $mediaEditor */ - foreach ($this->objects as $mediaEditor) { + foreach ($this->getObjects() as $mediaEditor) { $mediaEditor->deleteFiles(); } @@ -460,7 +459,7 @@ class MediaAction extends AbstractDatabaseObjectAction implements ISearchAction, */ protected function unmarkItems(array $mediaIDs = []) { if (empty($mediaIDs)) { - foreach ($this->objects as $media) { + foreach ($this->getObjects() as $media) { $mediaIDs[] = $media->mediaID; } } diff --git a/wcfsetup/install/files/lib/data/menu/MenuAction.class.php b/wcfsetup/install/files/lib/data/menu/MenuAction.class.php index 09a4928340..5fc61db58a 100644 --- a/wcfsetup/install/files/lib/data/menu/MenuAction.class.php +++ b/wcfsetup/install/files/lib/data/menu/MenuAction.class.php @@ -76,7 +76,7 @@ class MenuAction extends AbstractDatabaseObjectAction { public function validateDelete() { parent::validateDelete(); - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { if (!$object->canDelete()) { throw new PermissionDeniedException(); } diff --git a/wcfsetup/install/files/lib/data/menu/item/MenuItemAction.class.php b/wcfsetup/install/files/lib/data/menu/item/MenuItemAction.class.php index 48c976ca3b..cb9176cd32 100644 --- a/wcfsetup/install/files/lib/data/menu/item/MenuItemAction.class.php +++ b/wcfsetup/install/files/lib/data/menu/item/MenuItemAction.class.php @@ -55,7 +55,7 @@ class MenuItemAction extends AbstractDatabaseObjectAction implements ISortableAc public function validateToggle() { parent::validateUpdate(); - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { if (!$object->canDisable()) { throw new PermissionDeniedException(); } @@ -66,7 +66,7 @@ class MenuItemAction extends AbstractDatabaseObjectAction implements ISortableAc * @inheritDoc */ public function toggle() { - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { $object->update(['isDisabled' => ($object->isDisabled) ? 0 : 1]); } } diff --git a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php index a527622df4..a753ce4974 100644 --- a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php +++ b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php @@ -75,7 +75,7 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { } $queueIDs = []; - foreach ($this->objects as $queue) { + foreach ($this->getObjects() as $queue) { $queueIDs[] = $queue->queueID; } @@ -291,7 +291,7 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - foreach ($this->objects as $queue) { + foreach ($this->getObjects() as $queue) { VisitTracker::getInstance()->trackObjectVisit('com.woltlab.wcf.moderation.queue', $queue->queueID, $this->parameters['visitTime']); } @@ -316,7 +316,7 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - foreach ($this->objects as $queue) { + foreach ($this->getObjects() as $queue) { if (!$queue->canEdit()) { throw new PermissionDeniedException(); } diff --git a/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php b/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php index 85ae432a8c..1bdcc52f74 100644 --- a/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php +++ b/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php @@ -112,7 +112,7 @@ class NoticeAction extends AbstractDatabaseObjectAction implements ISortableActi * @inheritDoc */ public function toggle() { - foreach ($this->objects as $notice) { + foreach ($this->getObjects() as $notice) { $notice->update([ 'isDisabled' => $notice->isDisabled ? 0 : 1 ]); diff --git a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php index 3342288c0f..00f94114fc 100644 --- a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php +++ b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php @@ -54,7 +54,7 @@ class PackageUpdateServerAction extends AbstractDatabaseObjectAction implements * @inheritDoc */ public function toggle() { - foreach ($this->objects as $server) { + foreach ($this->getObjects() as $server) { $server->update(['isDisabled' => ($server->isDisabled) ? 0 : 1]); } } diff --git a/wcfsetup/install/files/lib/data/page/PageAction.class.php b/wcfsetup/install/files/lib/data/page/PageAction.class.php index 96f39f74e8..a77034124a 100644 --- a/wcfsetup/install/files/lib/data/page/PageAction.class.php +++ b/wcfsetup/install/files/lib/data/page/PageAction.class.php @@ -126,7 +126,7 @@ class PageAction extends AbstractDatabaseObjectAction implements ISearchAction, VALUES (?, ?, ?, ?, ?, ?, ?)"; $insertStatement = WCF::getDB()->prepareStatement($sql); - foreach ($this->objects as $page) { + foreach ($this->getObjects() as $page) { $deleteStatement->execute([$page->pageID]); foreach ($this->parameters['content'] as $languageID => $content) { @@ -161,7 +161,7 @@ class PageAction extends AbstractDatabaseObjectAction implements ISearchAction, VALUES (?, ?, ?)"; $insertStatement = WCF::getDB()->prepareStatement($sql); - foreach ($this->objects as $page) { + foreach ($this->getObjects() as $page) { $deleteStatement->execute([$page->pageID]); foreach ($this->parameters['boxToPage'] as $boxData) { @@ -181,7 +181,7 @@ class PageAction extends AbstractDatabaseObjectAction implements ISearchAction, public function validateDelete() { parent::validateDelete(); - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { if (!$object->canDelete()) { throw new PermissionDeniedException(); } @@ -194,7 +194,7 @@ class PageAction extends AbstractDatabaseObjectAction implements ISearchAction, public function validateToggle() { parent::validateUpdate(); - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { if (!$object->canDisable()) { throw new PermissionDeniedException(); } @@ -205,7 +205,7 @@ class PageAction extends AbstractDatabaseObjectAction implements ISearchAction, * @inheritDoc */ public function toggle() { - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { $object->update(['isDisabled' => ($object->isDisabled) ? 0 : 1]); } } @@ -233,13 +233,13 @@ class PageAction extends AbstractDatabaseObjectAction implements ISearchAction, * @inheritDoc */ public function delete() { - foreach ($this->objects as $page) { + foreach ($this->getObjects() as $page) { if ($page->pageType == 'tpl') { foreach ($page->getPageContent() as $languageID => $content) { $file = WCF_DIR . 'templates/' . $page->getTplName(($languageID ?: null)) . '.tpl'; if (file_exists($file)) { @unlink($file); - } + } } } } diff --git a/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscriptionAction.class.php b/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscriptionAction.class.php index f249f30b11..afb73350aa 100644 --- a/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscriptionAction.class.php +++ b/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscriptionAction.class.php @@ -66,7 +66,7 @@ class PaidSubscriptionAction extends AbstractDatabaseObjectAction implements ITo * @inheritDoc */ public function toggle() { - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { $object->update([ 'isDisabled' => $object->isDisabled ? 0 : 1 ]); diff --git a/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUserAction.class.php b/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUserAction.class.php index 3b9ed6121e..0667c1376a 100644 --- a/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUserAction.class.php +++ b/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUserAction.class.php @@ -89,7 +89,7 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - foreach ($this->objects as $subscriptionUser) { + foreach ($this->getObjects() as $subscriptionUser) { $endDate = 0; if (!isset($this->parameters['data']['endDate'])) { $subscription = $subscriptionUser->getSubscription(); @@ -133,7 +133,7 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - foreach ($this->objects as $subscriptionUser) { + foreach ($this->getObjects() as $subscriptionUser) { $subscriptionUser->update(['isActive' => 0]); // update group memberships @@ -150,7 +150,7 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - foreach ($this->objects as $subscriptionUser) { + foreach ($this->getObjects() as $subscriptionUser) { if (!$subscriptionUser->isActive) { throw new UserInputException('objectIDs'); } @@ -165,9 +165,9 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - foreach ($this->objects as $subscriptionUser) { + foreach ($this->getObjects() as $subscriptionUser) { $subscriptionUser->update(['isActive' => 1]); - + // update group memberships $action = new PaidSubscriptionUserAction([$subscriptionUser], 'addGroupMemberships'); $action->executeAction(); @@ -182,7 +182,7 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - foreach ($this->objects as $subscriptionUser) { + foreach ($this->getObjects() as $subscriptionUser) { if ($subscriptionUser->isActive) { throw new UserInputException('objectIDs'); } @@ -197,7 +197,7 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - foreach ($this->objects as $subscriptionUser) { + foreach ($this->getObjects() as $subscriptionUser) { $groupIDs = []; foreach (explode(',', $subscriptionUser->getSubscription()->groupIDs) as $groupID) { if (UserGroup::getGroupByID($groupID) !== null) { @@ -223,7 +223,7 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - foreach ($this->objects as $subscriptionUser) { + foreach ($this->getObjects() as $subscriptionUser) { $groupIDs = []; foreach (explode(',', $subscriptionUser->getSubscription()->groupIDs) as $groupID) { if (UserGroup::getGroupByID($groupID) !== null) { diff --git a/wcfsetup/install/files/lib/data/style/StyleAction.class.php b/wcfsetup/install/files/lib/data/style/StyleAction.class.php index 10ee604d65..1e26f142e5 100644 --- a/wcfsetup/install/files/lib/data/style/StyleAction.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleAction.class.php @@ -90,7 +90,7 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction, public function update() { parent::update(); - foreach ($this->objects as $style) { + foreach ($this->getObjects() as $style) { // update variables $this->updateVariables($style->getDecoratedObject(), true); @@ -108,7 +108,7 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction, public function delete() { $count = parent::delete(); - foreach ($this->objects as $style) { + foreach ($this->getObjects() as $style) { // remove custom images if ($style->imagePath && $style->imagePath != 'images/') { $this->removeDirectory($style->imagePath); @@ -581,7 +581,7 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction, public function validateToggle() { parent::validateUpdate(); - foreach ($this->objects as $style) { + foreach ($this->getObjects() as $style) { if ($style->isDefault) { throw new UserInputException('objectIDs'); } @@ -592,7 +592,7 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction, * @inheritdoc */ public function toggle() { - foreach ($this->objects as $style) { + foreach ($this->getObjects() as $style) { $isDisabled = ($style->isDisabled) ? 0 : 1; $style->update(['isDisabled' => $isDisabled]); } diff --git a/wcfsetup/install/files/lib/data/tag/TagAction.class.php b/wcfsetup/install/files/lib/data/tag/TagAction.class.php index 8a3ee604b7..e82cfe3174 100644 --- a/wcfsetup/install/files/lib/data/tag/TagAction.class.php +++ b/wcfsetup/install/files/lib/data/tag/TagAction.class.php @@ -142,7 +142,7 @@ class TagAction extends AbstractDatabaseObjectAction implements ISearchAction { ]); } - foreach ($this->objects as $tagEditor) { + foreach ($this->getObjects() as $tagEditor) { $this->tagEditor->addSynonym($tagEditor->getDecoratedObject()); } diff --git a/wcfsetup/install/files/lib/data/template/TemplateAction.class.php b/wcfsetup/install/files/lib/data/template/TemplateAction.class.php index e68519d099..81b4e1e5ef 100644 --- a/wcfsetup/install/files/lib/data/template/TemplateAction.class.php +++ b/wcfsetup/install/files/lib/data/template/TemplateAction.class.php @@ -75,7 +75,7 @@ class TemplateAction extends AbstractDatabaseObjectAction { public function update() { parent::update(); - foreach ($this->objects as $template) { + foreach ($this->getObjects() as $template) { // rename file $templateName = (isset($this->parameters['data']['templateName']) ? $this->parameters['data']['templateName'] : $template->templateName); $templateGroupID = (isset($this->parameters['data']['templateGroupID']) ? $this->parameters['data']['templateGroupID'] : $template->templateGroupID); diff --git a/wcfsetup/install/files/lib/data/user/UserAction.class.php b/wcfsetup/install/files/lib/data/user/UserAction.class.php index 53ddb1b33f..d3b87b15d0 100644 --- a/wcfsetup/install/files/lib/data/user/UserAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserAction.class.php @@ -125,7 +125,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio // delete avatars $avatarIDs = []; - foreach ($this->objects as $user) { + foreach ($this->getObjects() as $user) { if ($user->avatarID) $avatarIDs[] = $user->avatarID; } if (!empty($avatarIDs)) { @@ -309,7 +309,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio parent::update(); if (isset($this->parameters['data']['languageID'])) { - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { if ($object->userID == WCF::getUser()->userID) { if ($this->parameters['data']['languageID'] != WCF::getUser()->languageID) { WCF::setLanguage($this->parameters['data']['languageID']); @@ -346,7 +346,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio $action->executeAction(); } - foreach ($this->objects as $userEditor) { + foreach ($this->getObjects() as $userEditor) { if (!empty($userOptions)) { $userEditor->updateUserOptions($userOptions); } @@ -410,7 +410,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio $groupIDs = $this->parameters['groups']; - foreach ($this->objects as $userEditor) { + foreach ($this->getObjects() as $userEditor) { $userEditor->removeFromGroups($groupIDs); } @@ -442,7 +442,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio if (isset($this->parameters['deleteOldGroups'])) $deleteOldGroups = $this->parameters['deleteOldGroups']; if (isset($this->parameters['addDefaultGroups'])) $addDefaultGroups = $this->parameters['addDefaultGroups']; - foreach ($this->objects as $userEditor) { + foreach ($this->getObjects() as $userEditor) { $userEditor->addToGroups($groupIDs, $deleteOldGroups, $addDefaultGroups); } @@ -589,7 +589,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio // send e-mail notification if (empty($this->parameters['skipNotification'])) { - foreach ($this->objects as $user) { + foreach ($this->getObjects() as $user) { $mail = new Mail([$user->username => $user->email], $user->getLanguage()->getDynamicVariable('wcf.acp.user.activation.mail.subject'), $user->getLanguage()->getDynamicVariable('wcf.acp.user.activation.mail', [ 'username' => $user->username ])); @@ -673,7 +673,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio $disableSignatureExpires = 0; } - foreach ($this->objects as $userEditor) { + foreach ($this->getObjects() as $userEditor) { $userEditor->update([ 'disableSignature' => 1, 'disableSignatureReason' => $this->parameters['disableSignatureReason'], @@ -707,7 +707,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio $this->readObjects(); } - foreach ($this->objects as $userEditor) { + foreach ($this->getObjects() as $userEditor) { $userEditor->update([ 'disableSignature' => 0 ]); @@ -740,7 +740,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio $disableAvatarExpires = 0; } - foreach ($this->objects as $userEditor) { + foreach ($this->getObjects() as $userEditor) { $userEditor->update([ 'disableAvatar' => 1, 'disableAvatarReason' => $this->parameters['disableAvatarReason'], @@ -774,7 +774,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio $this->readObjects(); } - foreach ($this->objects as $userEditor) { + foreach ($this->getObjects() as $userEditor) { $userEditor->update([ 'disableAvatar' => 0 ]); diff --git a/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php b/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php index 5bf1f9d59e..b7f513fe7e 100644 --- a/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php @@ -320,7 +320,7 @@ class UserProfileAction extends UserAction { } $resetUserIDs = []; - foreach ($this->objects as $user) { + foreach ($this->getObjects() as $user) { $conditionBuilder = new PreparedStatementConditionBuilder(); $conditionBuilder->add('user_rank.groupID IN (?)', [$user->getGroupIDs()]); $conditionBuilder->add('user_rank.requiredPoints <= ?', [$user->activityPoints]); @@ -364,7 +364,7 @@ class UserProfileAction extends UserAction { } $userToGroup = []; - foreach ($this->objects as $user) { + foreach ($this->getObjects() as $user) { $conditionBuilder = new PreparedStatementConditionBuilder(); $conditionBuilder->add('groupID IN (?)', [$user->getGroupIDs()]); 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 6738703db7..a170115bcf 100644 --- a/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php +++ b/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php @@ -156,7 +156,7 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - foreach ($this->objects as $avatar) { + foreach ($this->getObjects() as $avatar) { $adapter = ImageHandler::getInstance()->getAdapter(); $adapter->loadFile($avatar->getLocation()); 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 ace89e95cc..f82ccf1c60 100644 --- a/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php +++ b/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php @@ -144,7 +144,7 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU } // validate ownership - foreach ($this->objects as $follow) { + foreach ($this->getObjects() as $follow) { if ($follow->userID != WCF::getUser()->userID) { throw new PermissionDeniedException(); } @@ -158,7 +158,7 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU $returnValues = parent::delete(); $followUserIDs = []; - foreach ($this->objects as $follow) { + foreach ($this->getObjects() as $follow) { $followUserIDs[] = $follow->followUserID; // remove activity event UserActivityEventHandler::getInstance()->removeEvents('com.woltlab.wcf.user.recentActivityEvent.follow', [$follow->followUserID]); diff --git a/wcfsetup/install/files/lib/data/user/group/UserGroupAction.class.php b/wcfsetup/install/files/lib/data/user/group/UserGroupAction.class.php index 0f7ba3ac84..b2d9d715ea 100644 --- a/wcfsetup/install/files/lib/data/user/group/UserGroupAction.class.php +++ b/wcfsetup/install/files/lib/data/user/group/UserGroupAction.class.php @@ -76,7 +76,7 @@ class UserGroupAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - foreach ($this->objects as $object) { + foreach ($this->getObjects() as $object) { $object->update($this->parameters['data']); $object->updateGroupOptions($this->parameters['options']); } diff --git a/wcfsetup/install/files/lib/data/user/group/assignment/UserGroupAssignmentAction.class.php b/wcfsetup/install/files/lib/data/user/group/assignment/UserGroupAssignmentAction.class.php index d18d157c13..60ab3660c1 100644 --- a/wcfsetup/install/files/lib/data/user/group/assignment/UserGroupAssignmentAction.class.php +++ b/wcfsetup/install/files/lib/data/user/group/assignment/UserGroupAssignmentAction.class.php @@ -47,7 +47,7 @@ class UserGroupAssignmentAction extends AbstractDatabaseObjectAction implements * @inheritDoc */ public function toggle() { - foreach ($this->objects as $assignment) { + foreach ($this->getObjects() as $assignment) { $assignment->update([ 'isDisabled' => $assignment->isDisabled ? 0 : 1 ]); 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 6585e25df3..663d5507b9 100644 --- a/wcfsetup/install/files/lib/data/user/ignore/UserIgnoreAction.class.php +++ b/wcfsetup/install/files/lib/data/user/ignore/UserIgnoreAction.class.php @@ -130,7 +130,7 @@ class UserIgnoreAction extends AbstractDatabaseObjectAction { } // validate ownership - foreach ($this->objects as $ignore) { + foreach ($this->getObjects() as $ignore) { if ($ignore->userID != WCF::getUser()->userID) { throw new PermissionDeniedException(); } diff --git a/wcfsetup/install/files/lib/data/user/option/UserOptionAction.class.php b/wcfsetup/install/files/lib/data/user/option/UserOptionAction.class.php index 8a0cdf4011..ac1da9dfb5 100644 --- a/wcfsetup/install/files/lib/data/user/option/UserOptionAction.class.php +++ b/wcfsetup/install/files/lib/data/user/option/UserOptionAction.class.php @@ -50,7 +50,7 @@ class UserOptionAction extends AbstractDatabaseObjectAction implements IToggleAc public function validateDelete() { parent::validateDelete(); - foreach ($this->objects as $userOption) { + foreach ($this->getObjects() as $userOption) { if (!$userOption->canDelete()) { throw new PermissionDeniedException(); } @@ -61,7 +61,7 @@ class UserOptionAction extends AbstractDatabaseObjectAction implements IToggleAc * @inheritDoc */ public function toggle() { - foreach ($this->objects as $optionEditor) { + foreach ($this->getObjects() as $optionEditor) { $optionEditor->update([ 'isDisabled' => 1 - $optionEditor->isDisabled ]);