MediaWiki  master
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  $status = Status::newGood();
87  for ( $this->reset(); $this->current(); $this->next() ) {
88  $item = $this->current();
89  $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove,
90  null, $item->getId(), null, $params, $reason, $user );
91  // Should only fail on second and subsequent times if the user trips
92  // the rate limiter
93  if ( !$status->isOK() ) {
94  break;
95  }
96  }
97 
98  return $status;
99  }
100 }
ChangeTagsList
Definition: ChangeTagsList.php:30
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:154
ChangeTagsRevisionList\getType
getType()
Get the internal type name of this list.
Definition: ChangeTagsRevisionList.php:30
ChangeTagsRevisionList\newItem
newItem( $row)
Create an item object from a DB result row.
Definition: ChangeTagsRevisionList.php:71
ChangeTagsRevisionItem
Item class for a live revision table row with its associated change tags.
Definition: ChangeTagsRevisionItem.php:26
ChangeTagsRevisionList
Stores a list of taggable revisions.
Definition: ChangeTagsRevisionList.php:29
$revQuery
$revQuery
Definition: testCompression.php:56
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
ChangeTags\modifyDisplayQuery
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='')
Applies all tags-related changes to a query.
Definition: ChangeTags.php:797
RevisionListBase\next
next()
Move the iteration pointer to the next list item, and return it.
Definition: RevisionListBase.php:112
RevisionListBase\current
current()
Get the current list item, or false if we are at the end.
Definition: RevisionListBase.php:103
ChangeTagsRevisionList\updateChangeTagsOnAll
updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, $reason, $user)
Add/remove change tags from all the revisions in the list.
Definition: ChangeTagsRevisionList.php:85
RevisionListBase\reset
reset()
Start iteration.
Definition: RevisionListBase.php:85
ChangeTagsRevisionList\doQuery
doQuery( $db)
Definition: ChangeTagsRevisionList.php:38
StatusValue\newGood
static newGood( $value=null)
Factory function for good results.
Definition: StatusValue.php:82
RevisionListBase\$ids
array $ids
Definition: RevisionListBase.php:34
ChangeTags\updateTagsWithChecks
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,...
Definition: ChangeTags.php:686