From f6d65e533c62f6deb21342d4901ece24497b433e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 4 Jun 2015 07:31:04 +0200 Subject: Update to MediaWiki 1.25.1 --- includes/changetags/ChangeTagsRevisionList.php | 99 ++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 includes/changetags/ChangeTagsRevisionList.php (limited to 'includes/changetags/ChangeTagsRevisionList.php') diff --git a/includes/changetags/ChangeTagsRevisionList.php b/includes/changetags/ChangeTagsRevisionList.php new file mode 100644 index 00000000..842d3272 --- /dev/null +++ b/includes/changetags/ChangeTagsRevisionList.php @@ -0,0 +1,99 @@ +ids ); + $queryInfo = array( + 'tables' => array( 'revision', 'user' ), + 'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ), + 'conds' => array( + 'rev_page' => $this->title->getArticleID(), + 'rev_id' => $ids, + ), + 'options' => array( 'ORDER BY' => 'rev_id DESC' ), + 'join_conds' => array( + 'page' => Revision::pageJoinCond(), + 'user' => Revision::userJoinCond(), + ), + ); + ChangeTags::modifyDisplayQuery( + $queryInfo['tables'], + $queryInfo['fields'], + $queryInfo['conds'], + $queryInfo['join_conds'], + $queryInfo['options'] + ); + return $db->select( + $queryInfo['tables'], + $queryInfo['fields'], + $queryInfo['conds'], + __METHOD__, + $queryInfo['options'], + $queryInfo['join_conds'] + ); + } + + public function newItem( $row ) { + return new ChangeTagsRevisionItem( $this, $row ); + } + + /** + * Add/remove change tags from all the revisions in the list. + * + * @param array $tagsToAdd + * @param array $tagsToRemove + * @param array $params + * @param string $reason + * @param User $user + * @return Status + */ + public function updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, + $reason, $user ) { + + // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + for ( $this->reset(); $this->current(); $this->next() ) { + // @codingStandardsIgnoreEnd + $item = $this->current(); + $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove, + null, $item->getId(), null, $params, $reason, $user ); + // Should only fail on second and subsequent times if the user trips + // the rate limiter + if ( !$status->isOK() ) { + break; + } + } + + return $status; + } +} -- cgit v1.2.3-54-g00ecf