MediaWiki REL1_35
ChangeTagsRevisionList.php
Go to the documentation of this file.
1<?php
24
30 public function getType() {
31 return 'revision';
32 }
33
38 public function doQuery( $db ) {
39 $ids = array_map( 'intval', $this->ids );
40 $revQuery = MediaWikiServices::getInstance()
41 ->getRevisionStore()
42 ->getQueryInfo( [ 'user' ] );
43 $queryInfo = [
44 'tables' => $revQuery['tables'],
45 'fields' => $revQuery['fields'],
46 'conds' => [
47 'rev_page' => $this->title->getArticleID(),
48 'rev_id' => $ids,
49 ],
50 'options' => [ 'ORDER BY' => 'rev_id DESC' ],
51 'join_conds' => $revQuery['joins'],
52 ];
54 $queryInfo['tables'],
55 $queryInfo['fields'],
56 $queryInfo['conds'],
57 $queryInfo['join_conds'],
58 $queryInfo['options'],
59 ''
60 );
61 return $db->select(
62 $queryInfo['tables'],
63 $queryInfo['fields'],
64 $queryInfo['conds'],
65 __METHOD__,
66 $queryInfo['options'],
67 $queryInfo['join_conds']
68 );
69 }
70
71 public function newItem( $row ) {
72 return new ChangeTagsRevisionItem( $this, $row );
73 }
74
85 public function updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, $reason, $user ) {
86 for ( $this->reset(); $this->current(); $this->next() ) {
87 $item = $this->current();
88 $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove,
89 null, $item->getId(), null, $params, $reason, $user );
90 // Should only fail on second and subsequent times if the user trips
91 // the rate limiter
92 if ( !$status->isOK() ) {
93 break;
94 }
95 }
96
97 return $status;
98 }
99}
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, $user)
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, User $user)
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.
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38