MediaWiki  1.28.1
ChangeTagsRevisionList.php
Go to the documentation of this file.
1 <?php
27  public function getType() {
28  return 'revision';
29  }
30 
35  public function doQuery( $db ) {
36  $ids = array_map( 'intval', $this->ids );
37  $queryInfo = [
38  'tables' => [ 'revision', 'user' ],
39  'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ),
40  'conds' => [
41  'rev_page' => $this->title->getArticleID(),
42  'rev_id' => $ids,
43  ],
44  'options' => [ 'ORDER BY' => 'rev_id DESC' ],
45  'join_conds' => [
46  'page' => Revision::pageJoinCond(),
47  'user' => Revision::userJoinCond(),
48  ],
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,
83  $reason, $user ) {
84 
85  // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
86  for ( $this->reset(); $this->current(); $this->next() ) {
87  // @codingStandardsIgnoreEnd
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 }
Item class for a live revision table row with its associated change tags.
Stores a list of taggable revisions.
reset()
Start iteration.
current()
Get the current list item, or false if we are at the end.
title
$params
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
Definition: Revision.php:442
Generic list for change tagging.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition: hooks.txt:242
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag=false)
Applies all tags-related changes to a query.
Definition: ChangeTags.php:629
next()
Move the iteration pointer to the next list item, and return it.
static pageJoinCond()
Return the value of a select() page conds array for the page table.
Definition: Revision.php:433
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
Definition: hooks.txt:1046
updateChangeTagsOnAll($tagsToAdd, $tagsToRemove, $params, $reason, $user)
Add/remove change tags from all the revisions in the list.
static userJoinCond()
Return the value of a select() JOIN conds array for the user table.
Definition: Revision.php:423
static selectUserFields()
Return the list of user fields that should be selected from user table.
Definition: Revision.php:530
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:526