MediaWiki REL1_37
ChangeTagsRevisionList.php
Go to the documentation of this file.
1<?php
25
31 public function getType() {
32 return 'revision';
33 }
34
39 public function doQuery( $db ) {
40 $ids = array_map( 'intval', $this->ids );
41 $revQuery = MediaWikiServices::getInstance()
42 ->getRevisionStore()
43 ->getQueryInfo( [ 'user' ] );
44 $queryInfo = [
45 'tables' => $revQuery['tables'],
46 'fields' => $revQuery['fields'],
47 'conds' => [
48 'rev_page' => $this->title->getId(),
49 'rev_id' => $ids,
50 ],
51 'options' => [ 'ORDER BY' => 'rev_id DESC' ],
52 'join_conds' => $revQuery['joins'],
53 ];
55 $queryInfo['tables'],
56 $queryInfo['fields'],
57 $queryInfo['conds'],
58 $queryInfo['join_conds'],
59 $queryInfo['options'],
60 ''
61 );
62 return $db->select(
63 $queryInfo['tables'],
64 $queryInfo['fields'],
65 $queryInfo['conds'],
66 __METHOD__,
67 $queryInfo['options'],
68 $queryInfo['join_conds']
69 );
70 }
71
72 public function newItem( $row ) {
73 return new ChangeTagsRevisionItem( $this, $row );
74 }
75
86 public function updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, $reason, Authority $performer ) {
87 $status = Status::newGood();
88 for ( $this->reset(); $this->current(); $this->next() ) {
89 $item = $this->current();
90 $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove,
91 null, $item->getId(), null, $params, $reason, $performer );
92 // Should only fail on second and subsequent times if the user trips
93 // the rate limiter
94 if ( !$status->isOK() ) {
95 break;
96 }
97 }
98
99 return $status;
100 }
101}
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( $tagsToAdd, $tagsToRemove, $params, $reason, Authority $performer)
Add/remove change tags from all the revisions in the list.
getType()
Get the internal type name of this list.
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='')
Applies all tags-related changes to a query.
static updateTagsWithChecks( $tagsToAdd, $tagsToRemove, $rc_id, $rev_id, $log_id, $params, $reason, Authority $performer)
Adds and/or removes tags to/from a given change, checking whether it is allowed first,...
MediaWikiServices is the service locator for the application scope of MediaWiki.
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.
This interface represents the authority associated the current execution context, such as a web reque...
Definition Authority.php:37
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38