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 }
ChangeTagsList
Definition: ChangeTagsList.php:30
ChangeTagsRevisionList\getType
getType()
Get the internal type name of this list.
Definition: ChangeTagsRevisionList.php:29
ChangeTagsRevisionList\newItem
newItem( $row)
Create an item object from a DB result row.
Definition: ChangeTagsRevisionList.php:68
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:28
$revQuery
$revQuery
Definition: testCompression.php:53
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:776
Revision\getQueryInfo
static getQueryInfo( $options=[])
Return the tables, fields, and join conditions to be selected to create a new revision object.
Definition: Revision.php:315
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:82
RevisionListBase\reset
reset()
Start iteration.
Definition: RevisionListBase.php:85
ChangeTagsRevisionList\doQuery
doQuery( $db)
Definition: ChangeTagsRevisionList.php:37
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:667