MediaWiki  master
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->page->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(
87  array $tagsToAdd,
88  array $tagsToRemove,
89  ?string $params,
90  string $reason,
91  Authority $performer
92  ) {
93  $status = Status::newGood();
94  for ( $this->reset(); $this->current(); $this->next() ) {
95  $item = $this->current();
96  $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove,
97  null, $item->getId(), null, $params, $reason, $performer );
98  // Should only fail on second and subsequent times if the user trips
99  // the rate limiter
100  if ( !$status->isOK() ) {
101  break;
102  }
103  }
104 
105  return $status;
106  }
107 }
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 modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='', bool $exclude=false)
Applies all tags-related changes to a query.
Definition: ChangeTags.php:906
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,...
Definition: ChangeTags.php:793
Service locator for MediaWiki core services.
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.
static newGood( $value=null)
Factory function for good results.
Definition: StatusValue.php:82
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:39
$revQuery