MediaWiki  master
ChangeTagsRevisionList.php
Go to the documentation of this file.
1 <?php
23 
29  public function getType() {
30  return 'revision';
31  }
32 
37  public function doQuery( $db ) {
38  $ids = array_map( 'intval', $this->ids );
39  $revQuery = Revision::getQueryInfo( [ 'user' ] );
40  $queryInfo = [
41  'tables' => $revQuery['tables'],
42  'fields' => $revQuery['fields'],
43  'conds' => [
44  'rev_page' => $this->title->getArticleID(),
45  'rev_id' => $ids,
46  ],
47  'options' => [ 'ORDER BY' => 'rev_id DESC' ],
48  'join_conds' => $revQuery['joins'],
49  ];
51  $queryInfo['tables'],
52  $queryInfo['fields'],
53  $queryInfo['conds'],
54  $queryInfo['join_conds'],
55  $queryInfo['options'],
56  ''
57  );
58  return $db->select(
59  $queryInfo['tables'],
60  $queryInfo['fields'],
61  $queryInfo['conds'],
62  __METHOD__,
63  $queryInfo['options'],
64  $queryInfo['join_conds']
65  );
66  }
67 
68  public function newItem( $row ) {
69  return new ChangeTagsRevisionItem( $this, $row );
70  }
71 
82  public function updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, $reason, $user ) {
83  for ( $this->reset(); $this->current(); $this->next() ) {
84  $item = $this->current();
85  $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove,
86  null, $item->getId(), null, $params, $reason, $user );
87  // Should only fail on second and subsequent times if the user trips
88  // the rate limiter
89  if ( !$status->isOK() ) {
90  break;
91  }
92  }
93 
94  return $status;
95  }
96 }
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='')
Applies all tags-related changes to a query.
Definition: ChangeTags.php:772
Item class for a live revision table row with its associated change tags.
Stores a list of taggable revisions.
updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, $reason, $user)
Add/remove change tags from all the revisions in the list.
reset()
Start iteration.
current()
Get the current list item, or false if we are at the end.
static getQueryInfo( $options=[])
Return the tables, fields, and join conditions to be selected to create a new revision object...
Definition: Revision.php:315
next()
Move the iteration pointer to the next list item, and return it.
$revQuery
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, and adding a log entry afterwards.
Definition: ChangeTags.php:663