MediaWiki master
ChangeTagsRevisionList.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\ChangeTags;
22
28
37 public function getType() {
38 return 'revision';
39 }
40
45 public function doQuery( $db ) {
46 $ids = array_map( 'intval', $this->ids );
47 $queryBuilder = MediaWikiServices::getInstance()->getRevisionStore()->newSelectQueryBuilder( $db )
48 ->joinComment()
49 ->joinUser()
50 ->where( [ 'rev_page' => $this->page->getId(), 'rev_id' => $ids ] )
51 ->orderBy( 'rev_id', SelectQueryBuilder::SORT_DESC );
52
53 MediaWikiServices::getInstance()->getChangeTagsStore()->modifyDisplayQueryBuilder( $queryBuilder, 'revision' );
54 return $queryBuilder->caller( __METHOD__ )->fetchResultSet();
55 }
56
58 public function newItem( $row ) {
59 return new ChangeTagsRevisionItem( $this, $row );
60 }
61
72 public function updateChangeTagsOnAll(
73 array $tagsToAdd,
74 array $tagsToRemove,
75 ?string $params,
76 string $reason,
77 Authority $performer
78 ) {
79 $status = Status::newGood();
80 for ( $this->reset(); $this->current(); $this->next() ) {
81 $item = $this->current();
82 $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove,
83 null, $item->getId(), null, $params, $reason, $performer );
84 // Should only fail on second and subsequent times if the user trips
85 // the rate limiter
86 if ( !$status->isOK() ) {
87 break;
88 }
89 }
90
91 return $status;
92 }
93}
94
96class_alias( ChangeTagsRevisionList::class, 'ChangeTagsRevisionList' );
Item class for a live revision table row with its associated change tags.
getType()
Get the internal type name of this list.Equal to the table name. Override this function....
updateChangeTagsOnAll(array $tagsToAdd, array $tagsToRemove, ?string $params, string $reason, Authority $performer)
Add/remove change tags from all the revisions in the list.
newItem( $row)
Create an item object from a DB result row.RevisionItemBase
static updateTagsWithChecks( $tagsToAdd, $tagsToRemove, $rc_id, $rev_id, $log_id, $params, string $reason, Authority $performer)
Adds and/or removes tags to/from a given change, checking whether it is allowed first,...
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.
current()
Get the current list item, or false if we are at the end.
next()
Move the iteration pointer to the next list item, and return it.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:54
Build SELECT queries with a fluent interface.
This interface represents the authority associated with the current execution context,...
Definition Authority.php:37
Result wrapper for grabbing data queried from an IDatabase object.