MediaWiki  1.29.1
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  $queryInfo = [
40  'tables' => [ 'revision', 'user' ],
41  'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ),
42  'conds' => [
43  'rev_page' => $this->title->getArticleID(),
44  'rev_id' => $ids,
45  ],
46  'options' => [ 'ORDER BY' => 'rev_id DESC' ],
47  'join_conds' => [
48  'page' => Revision::pageJoinCond(),
49  'user' => Revision::userJoinCond(),
50  ],
51  ];
53  $queryInfo['tables'],
54  $queryInfo['fields'],
55  $queryInfo['conds'],
56  $queryInfo['join_conds'],
57  $queryInfo['options'],
58  ''
59  );
60  return $db->select(
61  $queryInfo['tables'],
62  $queryInfo['fields'],
63  $queryInfo['conds'],
64  __METHOD__,
65  $queryInfo['options'],
66  $queryInfo['join_conds']
67  );
68  }
69 
70  public function newItem( $row ) {
71  return new ChangeTagsRevisionItem( $this, $row );
72  }
73 
84  public function updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params,
85  $reason, $user ) {
86 
87  // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
88  for ( $this->reset(); $this->current(); $this->next() ) {
89  // @codingStandardsIgnoreEnd
90  $item = $this->current();
91  $status = ChangeTags::updateTagsWithChecks( $tagsToAdd, $tagsToRemove,
92  null, $item->getId(), null, $params, $reason, $user );
93  // Should only fail on second and subsequent times if the user trips
94  // the rate limiter
95  if ( !$status->isOK() ) {
96  break;
97  }
98  }
99 
100  return $status;
101  }
102 }
ChangeTagsList
Generic list for change tagging.
Definition: ChangeTagsList.php:25
Revision\pageJoinCond
static pageJoinCond()
Return the value of a select() page conds array for the page table.
Definition: Revision.php:439
ChangeTagsRevisionList\getType
getType()
Get the internal type name of this list.
Definition: ChangeTagsRevisionList.php:29
$status
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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:1049
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
$user
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 account $user
Definition: hooks.txt:246
$params
$params
Definition: styleTest.css.php:40
ChangeTagsRevisionList\newItem
newItem( $row)
Create an item object from a DB result row.
Definition: ChangeTagsRevisionList.php:70
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
php
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
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:40
ChangeTags\modifyDisplayQuery
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag=false)
Applies all tags-related changes to a query.
Definition: ChangeTags.php:632
RevisionListBase\next
next()
Move the iteration pointer to the next list item, and return it.
Definition: RevisionList.php:112
RevisionListBase\current
current()
Get the current list item, or false if we are at the end.
Definition: RevisionList.php:104
ChangeTagsRevisionList\updateChangeTagsOnAll
updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, $reason, $user)
Add/remove change tags from all the revisions in the list.
Definition: ChangeTagsRevisionList.php:84
RevisionListBase\reset
reset()
Start iteration.
Definition: RevisionList.php:86
ChangeTagsRevisionList\doQuery
doQuery( $db)
Definition: ChangeTagsRevisionList.php:37
title
title
Definition: parserTests.txt:211
RevisionListBase\$ids
array $ids
Definition: RevisionList.php:35
Revision\userJoinCond
static userJoinCond()
Return the value of a select() JOIN conds array for the user table.
Definition: Revision.php:429
Revision\selectUserFields
static selectUserFields()
Return the list of user fields that should be selected from user table.
Definition: Revision.php:536
Revision\selectFields
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
Definition: Revision.php:448
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:529