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  $revQuery = MediaWikiServices::getInstance()
44  ->getRevisionStore()
45  ->getQueryInfo( [ 'user' ] );
46  $queryInfo = [
47  'tables' => $revQuery['tables'],
48  'fields' => $revQuery['fields'],
49  'conds' => [
50  'rev_page' => $this->page->getId(),
51  'rev_id' => $ids,
52  ],
53  'options' => [ 'ORDER BY' => 'rev_id DESC' ],
54  'join_conds' => $revQuery['joins'],
55  ];
57  $queryInfo['tables'],
58  $queryInfo['fields'],
59  $queryInfo['conds'],
60  $queryInfo['join_conds'],
61  $queryInfo['options'],
62  ''
63  );
64  return $db->select(
65  $queryInfo['tables'],
66  $queryInfo['fields'],
67  $queryInfo['conds'],
68  __METHOD__,
69  $queryInfo['options'],
70  $queryInfo['join_conds']
71  );
72  }
73 
74  public function newItem( $row ) {
75  return new ChangeTagsRevisionItem( $this, $row );
76  }
77 
88  public function updateChangeTagsOnAll(
89  array $tagsToAdd,
90  array $tagsToRemove,
91  ?string $params,
92  string $reason,
93  Authority $performer
94  ) {
95  $status = Status::newGood();
96  for ( $this->reset(); $this->current(); $this->next() ) {
97  $item = $this->current();
98  $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove,
99  null, $item->getId(), null, $params, $reason, $performer );
100  // Should only fail on second and subsequent times if the user trips
101  // the rate limiter
102  if ( !$status->isOK() ) {
103  break;
104  }
105  }
106 
107  return $status;
108  }
109 }
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:631
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:520
Service locator for MediaWiki core services.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition: Status.php:58
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:36
Result wrapper for grabbing data queried from an IDatabase object.