MediaWiki master
ChangeTagsRevisionList.php
Go to the documentation of this file.
1<?php
27
33 public function getType() {
34 return 'revision';
35 }
36
41 public function doQuery( $db ) {
42 $ids = array_map( 'intval', $this->ids );
43 $queryBuilder = MediaWikiServices::getInstance()->getRevisionStore()->newSelectQueryBuilder( $db )
44 ->joinComment()
45 ->joinUser()
46 ->where( [ 'rev_page' => $this->page->getId(), 'rev_id' => $ids ] )
47 ->orderBy( 'rev_id', SelectQueryBuilder::SORT_DESC );
48
49 MediaWikiServices::getInstance()->getChangeTagsStore()->modifyDisplayQueryBuilder( $queryBuilder, 'revision' );
50 return $queryBuilder->caller( __METHOD__ )->fetchResultSet();
51 }
52
53 public function newItem( $row ) {
54 return new ChangeTagsRevisionItem( $this, $row );
55 }
56
67 public function updateChangeTagsOnAll(
68 array $tagsToAdd,
69 array $tagsToRemove,
70 ?string $params,
71 string $reason,
72 Authority $performer
73 ) {
74 $status = Status::newGood();
75 for ( $this->reset(); $this->current(); $this->next() ) {
76 $item = $this->current();
77 $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove,
78 null, $item->getId(), null, $params, $reason, $performer );
79 // Should only fail on second and subsequent times if the user trips
80 // the rate limiter
81 if ( !$status->isOK() ) {
82 break;
83 }
84 }
85
86 return $status;
87 }
88}
array $params
The job parameters.
Item class for a live revision table row with its associated change tags.
Stores a list of taggable revisions.
newItem( $row)
Create an item object from a DB result row.
updateChangeTagsOnAll(array $tagsToAdd, array $tagsToRemove, ?string $params, string $reason, Authority $performer)
Add/remove change tags from all the revisions in the list.
getType()
Get the internal type name of this list.
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.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:54
reset()
Start iteration.
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.
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.