From cd9756104d7bc59baf075c585af90d64f8e4d892 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 8 May 2016 10:57:32 +0200 Subject: [PATCH] Use \PDO::fetchAll() instead of PreparedStatement::fetchColumns() --- .../acp/action/UserQuickSearchAction.class.php | 10 +++++----- .../files/lib/acp/form/BoxAddForm.class.php | 2 +- .../files/lib/acp/form/MenuAddForm.class.php | 2 +- .../files/lib/acp/form/StyleAddForm.class.php | 2 +- .../files/lib/acp/page/UserListPage.class.php | 2 +- .../files/lib/data/DatabaseObjectList.class.php | 2 +- .../data/attachment/AttachmentAction.class.php | 2 +- .../files/lib/data/bbcode/BBCodeAction.class.php | 2 +- .../install/files/lib/data/box/Box.class.php | 2 +- .../lib/data/comment/CommentEditor.class.php | 2 +- .../files/lib/data/label/LabelAction.class.php | 2 +- .../queue/ModerationQueueAction.class.php | 2 +- .../install/files/lib/data/page/Page.class.php | 2 +- .../files/lib/data/style/StyleEditor.class.php | 2 +- .../files/lib/data/user/TeamList.class.php | 2 +- .../install/files/lib/data/user/User.class.php | 4 ++-- .../files/lib/data/user/UserAction.class.php | 2 +- .../files/lib/data/user/UserProfile.class.php | 6 +++--- .../data/user/follow/UserFollowAction.class.php | 2 +- .../user/follow/UserFollowingAction.class.php | 2 +- .../lib/data/user/group/UserGroup.class.php | 10 +++++++++- .../visitor/UserProfileVisitorAction.class.php | 2 +- .../install/files/lib/form/SearchForm.class.php | 2 +- .../files/lib/form/UserSearchForm.class.php | 2 +- .../cronjob/AttachmentCleanUpCronjob.class.php | 2 +- .../DailyMailNotificationCronjob.class.php | 2 +- .../cronjob/ModerationQueueCronjob.class.php | 2 +- .../lib/system/cronjob/UserQuitCronjob.class.php | 2 +- .../statement/PreparedStatement.class.php | 16 +--------------- .../lib/system/edit/EditHistoryManager.class.php | 2 +- .../AbstractCommentResponseImporter.class.php | 2 +- .../lib/system/importer/UserImporter.class.php | 2 +- .../AbstractModerationQueueHandler.class.php | 2 +- .../PackageInstallationScheduler.class.php | 2 +- .../BoxPackageInstallationPlugin.class.php | 2 +- .../MenuPackageInstallationPlugin.class.php | 2 +- .../lib/system/session/SessionHandler.class.php | 4 ++-- .../UserCollapsibleContentHandler.class.php | 2 +- .../UserNotificationHandler.class.php | 6 +++--- ...ueCommentUserNotificationObjectType.class.php | 4 ++-- .../watch/UserObjectWatchHandler.class.php | 2 +- 41 files changed, 60 insertions(+), 66 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/action/UserQuickSearchAction.class.php b/wcfsetup/install/files/lib/acp/action/UserQuickSearchAction.class.php index effab7b639..4acc62fcde 100644 --- a/wcfsetup/install/files/lib/acp/action/UserQuickSearchAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/UserQuickSearchAction.class.php @@ -97,7 +97,7 @@ class UserQuickSearchAction extends AbstractAction { WHERE banned = ?"; $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults); $statement->execute(array(1)); - $this->matches = $statement->fetchColumns(); + $this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN); break; case 'newest': @@ -111,7 +111,7 @@ class UserQuickSearchAction extends AbstractAction { ORDER BY user_table.registrationDate DESC"; $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults); $statement->execute(); - $this->matches = $statement->fetchColumns(); + $this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN); break; case 'disabled': @@ -125,7 +125,7 @@ class UserQuickSearchAction extends AbstractAction { ORDER BY user_table.registrationDate DESC"; $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults); $statement->execute(array(0)); - $this->matches = $statement->fetchColumns(); + $this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN); break; case 'disabledAvatars': @@ -136,7 +136,7 @@ class UserQuickSearchAction extends AbstractAction { WHERE disableAvatar = ?"; $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults); $statement->execute(array(1)); - $this->matches = $statement->fetchColumns(); + $this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN); break; case 'disabledSignatures': @@ -147,7 +147,7 @@ class UserQuickSearchAction extends AbstractAction { WHERE disableSignature = ?"; $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults); $statement->execute(array(1)); - $this->matches = $statement->fetchColumns(); + $this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN); break; } diff --git a/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php b/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php index f861b04d47..0704dee867 100644 --- a/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php @@ -317,7 +317,7 @@ class BoxAddForm extends AbstractForm { " . $conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditionBuilder->getParameters()); - $this->pageIDs = $statement->fetchColumns(); + $this->pageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); } // validate images diff --git a/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php b/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php index 6c94b85c8d..285f8e0cb3 100644 --- a/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php @@ -132,7 +132,7 @@ class MenuAddForm extends AbstractForm { " . $conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditionBuilder->getParameters()); - $this->pageIDs = $statement->fetchColumns(); + $this->pageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); } } diff --git a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php index ca1002f98d..308c1599dc 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php @@ -336,7 +336,7 @@ class StyleAddForm extends AbstractForm { FROM wcf".WCF_N."_style_variable"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); - $variables = $statement->fetchColumns(); + $variables = $statement->fetchAll(\PDO::FETCH_COLUMN); $lines = explode("\n", StringUtil::unifyNewlines($this->variables['overrideScss'])); $regEx = new Regex('^@([a-zA-Z]+): ?([@a-zA-Z0-9 ,\.\(\)\%\#-]+);$'); diff --git a/wcfsetup/install/files/lib/acp/page/UserListPage.class.php b/wcfsetup/install/files/lib/acp/page/UserListPage.class.php index 2beb0b4f5a..15aaf7144f 100755 --- a/wcfsetup/install/files/lib/acp/page/UserListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UserListPage.class.php @@ -240,7 +240,7 @@ class UserListPage extends SortablePage { ORDER BY ".(($this->sortField != 'email' && isset($this->options[$this->sortField])) ? 'user_option_value.userOption'.$this->options[$this->sortField]->optionID : $this->sortField)." ".$this->sortOrder; $statement = WCF::getDB()->prepareStatement($sql, $this->itemsPerPage, ($this->pageNo - 1) * $this->itemsPerPage); $statement->execute($this->conditions->getParameters()); - $userIDs = $statement->fetchColumns(); + $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // get user data if (!empty($userIDs)) { diff --git a/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php b/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php index 1bef8c9893..2a0b7f5d42 100644 --- a/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php +++ b/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php @@ -165,7 +165,7 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject { ".(!empty($this->sqlOrderBy) ? "ORDER BY ".$this->sqlOrderBy : ''); $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset); $statement->execute($this->getConditionBuilder()->getParameters()); - $this->objectIDs = $statement->fetchColumns(); + $this->objectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); } /** diff --git a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php index 171e0713fc..c3e1e6f09d 100644 --- a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php +++ b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php @@ -261,7 +261,7 @@ class AttachmentAction extends AbstractDatabaseObjectAction implements ISortable ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $attachmentIDs = $statement->fetchColumns(); + $attachmentIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); foreach ($this->parameters['attachmentIDs'] as $attachmentID) { if (!in_array($attachmentID, $attachmentIDs)) { diff --git a/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php b/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php index 2ef4ed8e95..1c304cd84e 100644 --- a/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php +++ b/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php @@ -51,7 +51,7 @@ class BBCodeAction extends AbstractDatabaseObjectAction implements IToggleAction WHERE optionType = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array('BBCodeSelect')); - $optionIDs = $statement->fetchColumns(); + $optionIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($optionIDs)) { $conditionBuilder = new PreparedStatementConditionBuilder(); diff --git a/wcfsetup/install/files/lib/data/box/Box.class.php b/wcfsetup/install/files/lib/data/box/Box.class.php index 3d3d6a56aa..9e43fd1819 100644 --- a/wcfsetup/install/files/lib/data/box/Box.class.php +++ b/wcfsetup/install/files/lib/data/box/Box.class.php @@ -460,7 +460,7 @@ class Box extends DatabaseObject { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([$this->boxID]); - $this->pageIDs = $statement->fetchColumns(); + $this->pageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); } return $this->pageIDs; diff --git a/wcfsetup/install/files/lib/data/comment/CommentEditor.class.php b/wcfsetup/install/files/lib/data/comment/CommentEditor.class.php index 1903c579c9..0d020497bf 100644 --- a/wcfsetup/install/files/lib/data/comment/CommentEditor.class.php +++ b/wcfsetup/install/files/lib/data/comment/CommentEditor.class.php @@ -29,7 +29,7 @@ class CommentEditor extends DatabaseObjectEditor { ORDER BY time ASC, responseID ASC"; $statement = WCF::getDB()->prepareStatement($sql, 5); $statement->execute(array($this->commentID)); - $responseIDs = $statement->fetchColumns(); + $responseIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); $this->update(array( 'responseIDs' => serialize($responseIDs) diff --git a/wcfsetup/install/files/lib/data/label/LabelAction.class.php b/wcfsetup/install/files/lib/data/label/LabelAction.class.php index b3a90c19dc..d2fb1b0e97 100644 --- a/wcfsetup/install/files/lib/data/label/LabelAction.class.php +++ b/wcfsetup/install/files/lib/data/label/LabelAction.class.php @@ -100,7 +100,7 @@ class LabelAction extends AbstractDatabaseObjectAction implements ISortableActio ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $languageItemIDs = $statement->fetchColumns(); + $languageItemIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); $objectAction = new LanguageItemAction($languageItemIDs, 'delete'); $objectAction->executeAction(); 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 43072696d6..321970b148 100644 --- a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php +++ b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php @@ -120,7 +120,7 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { ORDER BY moderation_queue.lastChangeTime DESC"; $statement = WCF::getDB()->prepareStatement($sql, 5); $statement->execute($conditions->getParameters()); - $queueIDs = $statement->fetchColumns(); + $queueIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); $queues = array(); if (!empty($queueIDs)) { diff --git a/wcfsetup/install/files/lib/data/page/Page.class.php b/wcfsetup/install/files/lib/data/page/Page.class.php index b40033b1cf..48181a8104 100644 --- a/wcfsetup/install/files/lib/data/page/Page.class.php +++ b/wcfsetup/install/files/lib/data/page/Page.class.php @@ -275,7 +275,7 @@ class Page extends DatabaseObject implements ILinkableObject, ITitledObject { WHERE pageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([$this->pageID]); - $this->boxIDs = $statement->fetchColumns(); + $this->boxIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); } return $this->boxIDs; diff --git a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php index 7d541668cb..121a12a283 100644 --- a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php @@ -420,7 +420,7 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject WHERE templateGroupID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([$style->templateGroupID]); - $knownTemplates = $statement->fetchColumns(); + $knownTemplates = $statement->fetchAll(\PDO::FETCH_COLUMN); } // copy templates diff --git a/wcfsetup/install/files/lib/data/user/TeamList.class.php b/wcfsetup/install/files/lib/data/user/TeamList.class.php index 6836c7bbd4..c4ed80279a 100644 --- a/wcfsetup/install/files/lib/data/user/TeamList.class.php +++ b/wcfsetup/install/files/lib/data/user/TeamList.class.php @@ -51,7 +51,7 @@ class TeamList extends UserProfileList { ORDER BY user_group.priority DESC".(!empty($this->sqlOrderBy) ? ", ".$this->sqlOrderBy : ''); $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset); $statement->execute(); - $this->objectIDs = $statement->fetchColumns(); + $this->objectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); } /** diff --git a/wcfsetup/install/files/lib/data/user/User.class.php b/wcfsetup/install/files/lib/data/user/User.class.php index c9fb307322..a6dd23718c 100644 --- a/wcfsetup/install/files/lib/data/user/User.class.php +++ b/wcfsetup/install/files/lib/data/user/User.class.php @@ -208,7 +208,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([$this->userID]); - $this->groupIDs = $statement->fetchColumns(); + $this->groupIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // update storage data if (!$skipCache) { @@ -246,7 +246,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([$this->userID]); - $this->languageIDs = $statement->fetchColumns(); + $this->languageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // update storage data UserStorageHandler::getInstance()->update($this->userID, 'languageIDs', serialize($this->languageIDs)); diff --git a/wcfsetup/install/files/lib/data/user/UserAction.class.php b/wcfsetup/install/files/lib/data/user/UserAction.class.php index 251c8127ea..97618dabdd 100644 --- a/wcfsetup/install/files/lib/data/user/UserAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserAction.class.php @@ -95,7 +95,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $groupIDs = $statement->fetchColumns(); + $groupIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!UserGroup::isAccessibleGroup($groupIDs)) { throw new PermissionDeniedException(); diff --git a/wcfsetup/install/files/lib/data/user/UserProfile.class.php b/wcfsetup/install/files/lib/data/user/UserProfile.class.php index 934dbac131..61e9860cb3 100644 --- a/wcfsetup/install/files/lib/data/user/UserProfile.class.php +++ b/wcfsetup/install/files/lib/data/user/UserProfile.class.php @@ -168,7 +168,7 @@ class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject { WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([$this->userID]); - $this->followingUserIDs = $statement->fetchColumns(); + $this->followingUserIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // update storage data UserStorageHandler::getInstance()->update($this->userID, 'followingUserIDs', serialize($this->followingUserIDs)); @@ -202,7 +202,7 @@ class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject { WHERE followUserID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([$this->userID]); - $this->followerUserIDs = $statement->fetchColumns(); + $this->followerUserIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // update storage data UserStorageHandler::getInstance()->update($this->userID, 'followerUserIDs', serialize($this->followerUserIDs)); @@ -236,7 +236,7 @@ class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject { WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([$this->userID]); - $this->ignoredUserIDs = $statement->fetchColumns(); + $this->ignoredUserIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // update storage data UserStorageHandler::getInstance()->update($this->userID, 'ignoredUserIDs', serialize($this->ignoredUserIDs)); 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 38a9b0f14a..999a0678e1 100644 --- a/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php +++ b/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php @@ -198,7 +198,7 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU WHERE followUserID = ?"; $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20); $statement->execute(array($this->parameters['userID'])); - $userIDs = $statement->fetchColumns(); + $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // create group $group = new GroupedUserList(); 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 46f79b55ee..93fd45fd0d 100644 --- a/wcfsetup/install/files/lib/data/user/follow/UserFollowingAction.class.php +++ b/wcfsetup/install/files/lib/data/user/follow/UserFollowingAction.class.php @@ -52,7 +52,7 @@ class UserFollowingAction extends UserFollowAction { WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20); $statement->execute(array($this->parameters['userID'])); - $userIDs = $statement->fetchColumns(); + $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // create group $group = new GroupedUserList(); diff --git a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php index 18f528b4e3..4820ee78f0 100644 --- a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php +++ b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php @@ -1,5 +1,6 @@ get($this->groupName); + } } 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 c5ed9b5d09..06ebce9015 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 @@ -62,7 +62,7 @@ class UserProfileVisitorAction extends AbstractDatabaseObjectAction implements I ORDER BY time DESC"; $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20); $statement->execute(array($this->parameters['userID'])); - $userIDs = $statement->fetchColumns(); + $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // create group $group = new GroupedUserList(); diff --git a/wcfsetup/install/files/lib/form/SearchForm.class.php b/wcfsetup/install/files/lib/form/SearchForm.class.php index 4531812256..c6d88d82d9 100644 --- a/wcfsetup/install/files/lib/form/SearchForm.class.php +++ b/wcfsetup/install/files/lib/form/SearchForm.class.php @@ -495,7 +495,7 @@ class SearchForm extends AbstractCaptchaForm { WHERE username ".($this->nameExactly ? "= ?" : "LIKE ?"); $statement = WCF::getDB()->prepareStatement($sql, 100); $statement->execute(array($this->username.(!$this->nameExactly ? '%' : ''))); - $userIDs = $statement->fetchColumns(); + $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (empty($userIDs)) { $this->throwNoMatchesException(); diff --git a/wcfsetup/install/files/lib/form/UserSearchForm.class.php b/wcfsetup/install/files/lib/form/UserSearchForm.class.php index 04d6e7bf6b..6990320246 100644 --- a/wcfsetup/install/files/lib/form/UserSearchForm.class.php +++ b/wcfsetup/install/files/lib/form/UserSearchForm.class.php @@ -175,7 +175,7 @@ class UserSearchForm extends UserOptionListForm { // do search $statement = WCF::getDB()->prepareStatement($sql.$this->conditions, $this->maxResults); $statement->execute($this->conditions->getParameters()); - $this->matches = $statement->fetchColumns(); + $this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN); } /** diff --git a/wcfsetup/install/files/lib/system/cronjob/AttachmentCleanUpCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/AttachmentCleanUpCronjob.class.php index f7979d8fec..4fc04164c3 100644 --- a/wcfsetup/install/files/lib/system/cronjob/AttachmentCleanUpCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/AttachmentCleanUpCronjob.class.php @@ -31,7 +31,7 @@ class AttachmentCleanUpCronjob extends AbstractCronjob { 0, (TIME_NOW - 86400) )); - $attachmentIDs = $statement->fetchColumns(); + $attachmentIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($attachmentIDs)) { AttachmentEditor::deleteAll($attachmentIDs); diff --git a/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php index dc1fe3cd3c..5510a26e4f 100644 --- a/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php @@ -43,7 +43,7 @@ class DailyMailNotificationCronjob extends AbstractCronjob { TIME_NOW - 3600 * 23, 0 )); - $userIDs = $statement->fetchColumns(); + $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (empty($userIDs)) return; // get users diff --git a/wcfsetup/install/files/lib/system/cronjob/ModerationQueueCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/ModerationQueueCronjob.class.php index 4171428aa6..fbf9dee464 100644 --- a/wcfsetup/install/files/lib/system/cronjob/ModerationQueueCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/ModerationQueueCronjob.class.php @@ -32,7 +32,7 @@ class ModerationQueueCronjob extends AbstractCronjob { ModerationQueue::STATUS_DONE, (TIME_NOW - (86400 * 30)) )); - $queueIDs = $statement->fetchColumns(); + $queueIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($queueIDs)) { $conditions = new PreparedStatementConditionBuilder(); diff --git a/wcfsetup/install/files/lib/system/cronjob/UserQuitCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/UserQuitCronjob.class.php index f65050eab2..829fad90e1 100644 --- a/wcfsetup/install/files/lib/system/cronjob/UserQuitCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/UserQuitCronjob.class.php @@ -30,7 +30,7 @@ class UserQuitCronjob extends AbstractCronjob { 0, (TIME_NOW - 7 * 24 * 3600) )); - $userIDs = $statement->fetchColumns(); + $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($userIDs)) { $action = new UserAction($userIDs, 'delete'); diff --git a/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php b/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php index 7d39de6c8a..ca872fd8e0 100644 --- a/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php +++ b/wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php @@ -20,6 +20,7 @@ use wcf\system\WCF; * * @method boolean closeCursor() * @method mixed fetch($fetch_style, $cursor_orientation = \PDO::FETCH_ORI_NEXT, $cursor_offset = 0) + * @method array fetchAll($fetch_style = \PDO::ATTR_DEFAULT_FETCH_MODE, $fetch_argument = null, $ctor_args = []) * @method mixed fetchColumn($column_number = 0) */ class PreparedStatement { @@ -159,21 +160,6 @@ class PreparedStatement { return $column; } - /** - * Returns a specific column for all of the remaining rows. - * - * @param integer $columnNumber - * @return array - */ - public function fetchColumns($columnNumber = 0) { - $columns = []; - while ($column = $this->fetchColumn($columnNumber)) { - $columns[] = $column; - } - - return $columns; - } - /** * Fetches the next row from a result set in a database object. * diff --git a/wcfsetup/install/files/lib/system/edit/EditHistoryManager.class.php b/wcfsetup/install/files/lib/system/edit/EditHistoryManager.class.php index 92de7cc17c..872c69f384 100644 --- a/wcfsetup/install/files/lib/system/edit/EditHistoryManager.class.php +++ b/wcfsetup/install/files/lib/system/edit/EditHistoryManager.class.php @@ -133,7 +133,7 @@ class EditHistoryManager extends SingletonFactory { $userIDs )); - $entryIDs = $statement->fetchColumns(); + $entryIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (empty($entryIDs)) return; $list = new EditHistoryEntryList(); diff --git a/wcfsetup/install/files/lib/system/importer/AbstractCommentResponseImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractCommentResponseImporter.class.php index bcb05ec292..87a704311c 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractCommentResponseImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractCommentResponseImporter.class.php @@ -42,7 +42,7 @@ class AbstractCommentResponseImporter extends AbstractImporter { ORDER BY time ASC, responseID ASC"; $statement = WCF::getDB()->prepareStatement($sql, 5); $statement->execute(array($response->commentID)); - $responseIDs = $statement->fetchColumns(); + $responseIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // update parent comment $sql = "UPDATE wcf".WCF_N."_comment diff --git a/wcfsetup/install/files/lib/system/importer/UserImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserImporter.class.php index 7b91f835de..aee9bf306f 100644 --- a/wcfsetup/install/files/lib/system/importer/UserImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/UserImporter.class.php @@ -49,7 +49,7 @@ class UserImporter extends AbstractImporter { WHERE preset = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array(1)); - $this->eventIDs = $statement->fetchColumns(); + $this->eventIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); $userOptionList = new UserOptionList(); $userOptionList->readObjects(); diff --git a/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueHandler.class.php b/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueHandler.class.php index be94ea0474..6353beb685 100644 --- a/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueHandler.class.php +++ b/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueHandler.class.php @@ -89,7 +89,7 @@ abstract class AbstractModerationQueueHandler implements IModerationQueueHandler ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $queueIDs = $statement->fetchColumns(); + $queueIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($queueIDs)) { $queueAction = new ModerationQueueAction($queueIDs, 'delete'); diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php index d66ebbabbe..1cbf68af8f 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php @@ -477,7 +477,7 @@ class PackageInstallationScheduler { $package->package, $match[1].'%' )); - $packageVersions = $statement->fetchColumns(); + $packageVersions = $statement->fetchAll(\PDO::FETCH_COLUMN); if (count($packageVersions) > 1) { // sort by version number diff --git a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php index efc2f2bc69..848d8f8cee 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php @@ -345,7 +345,7 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin ".$conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditionBuilder->getParameters()); - $pageIDs = $statement->fetchColumns(); + $pageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // save page ids foreach ($pageIDs as $pageID) { diff --git a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php index 0ae8e847c0..204f34189d 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php @@ -258,7 +258,7 @@ class MenuPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin " . $conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditionBuilder->getParameters()); - $pageIDs = $statement->fetchColumns(); + $pageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // save page ids foreach ($pageIDs as $pageID) { diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index 0e390a8796..10a7569c9f 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -628,7 +628,7 @@ class SessionHandler extends SingletonFactory { WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->user->userID)); - $groupIDs = $statement->fetchColumns(); + $groupIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); } else { $groupIDs = $this->user->getGroupIDs(); @@ -671,7 +671,7 @@ class SessionHandler extends SingletonFactory { WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->user->userID)); - $this->languageIDs = $statement->fetchColumns(); + $this->languageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); } else { $this->languageIDs = $this->user->getLanguageIDs(); diff --git a/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php b/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php index f5f28a51cc..2e0d5ad4af 100644 --- a/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php @@ -102,7 +102,7 @@ class UserCollapsibleContentHandler extends SingletonFactory { $objectTypeID, WCF::getUser()->userID )); - $this->collapsedContent[$objectTypeID] = $statement->fetchColumns(); + $this->collapsedContent[$objectTypeID] = $statement->fetchAll(\PDO::FETCH_COLUMN); // update storage data UserStorageHandler::getInstance()->update(WCF::getUser()->userID, 'collapsedContent-'.$objectTypeID, serialize($this->collapsedContent[$objectTypeID])); 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 15404ef42b..1dd365bfc2 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -156,7 +156,7 @@ class UserNotificationHandler extends SingletonFactory { ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $notificationIDs = $statement->fetchColumns(); + $notificationIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // filter array of existing notifications and remove values which // do not have a notification from this author yet (inverse logic!) @@ -706,7 +706,7 @@ class UserNotificationHandler extends SingletonFactory { $statement->execute(array( $objectTypeObj->objectTypeID )); - $eventIDs = $statement->fetchColumns(); + $eventIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($eventIDs)) { $conditions = new PreparedStatementConditionBuilder(); @@ -718,7 +718,7 @@ class UserNotificationHandler extends SingletonFactory { ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $userIDs = $statement->fetchColumns(); + $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // reset number of notifications if (!empty($userIDs)) { diff --git a/wcfsetup/install/files/lib/system/user/notification/object/type/TMultiRecipientModerationQueueCommentUserNotificationObjectType.class.php b/wcfsetup/install/files/lib/system/user/notification/object/type/TMultiRecipientModerationQueueCommentUserNotificationObjectType.class.php index 2869de50b1..91a70cbdc9 100644 --- a/wcfsetup/install/files/lib/system/user/notification/object/type/TMultiRecipientModerationQueueCommentUserNotificationObjectType.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/object/type/TMultiRecipientModerationQueueCommentUserNotificationObjectType.class.php @@ -63,7 +63,7 @@ trait TMultiRecipientModerationQueueCommentUserNotificationObjectType { $comment->objectID, $objectTypeID ]); - $recipientIDs = $statement->fetchColumns(); + $recipientIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // make sure that all users can (still) access the moderation queue entry if (!empty($recipientIDs)) { @@ -76,7 +76,7 @@ trait TMultiRecipientModerationQueueCommentUserNotificationObjectType { ".$conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditionBuilder->getParameters()); - $recipientIDs = $statement->fetchColumns(); + $recipientIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // make sure that all users (still) have permission to access moderation if (!$recipientIDs) { diff --git a/wcfsetup/install/files/lib/system/user/object/watch/UserObjectWatchHandler.class.php b/wcfsetup/install/files/lib/system/user/object/watch/UserObjectWatchHandler.class.php index 23b2ccfddb..a648c512e8 100644 --- a/wcfsetup/install/files/lib/system/user/object/watch/UserObjectWatchHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/object/watch/UserObjectWatchHandler.class.php @@ -61,7 +61,7 @@ class UserObjectWatchHandler extends SingletonFactory { ".$conditionsBuilder; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditionsBuilder->getParameters()); - $userIDs = $statement->fetchColumns(); + $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($userIDs)) { // reset user storage -- 2.20.1