MediaWiki master
ChangeTagsList.php
Go to the documentation of this file.
1<?php
6
7namespace MediaWiki\ChangeTags;
8
9use InvalidArgumentException;
10use MediaWiki\Context\IContextSource;
11use MediaWiki\MediaWikiServices;
12use MediaWiki\Page\PageIdentity;
13use MediaWiki\Permissions\Authority;
14use MediaWiki\RevisionList\RevisionListBase;
15use MediaWiki\Status\Status;
16
26abstract class ChangeTagsList extends RevisionListBase {
27 public function __construct( IContextSource $context, PageIdentity $page, array $ids ) {
28 parent::__construct( $context, $page );
29 $this->ids = $ids;
30 }
31
42 public static function factory( $typeName, IContextSource $context,
44 ) {
45 $className = match ( $typeName ) {
46 'revision' => ChangeTagsRevisionList::class,
47 'logentry' => ChangeTagsLogList::class,
48 default => throw new InvalidArgumentException( "Class $typeName requested, but does not exist" )
49 };
50 return new $className( $context, $page, $ids );
51 }
52
56 public function reloadFromPrimary() {
57 $dbw = MediaWikiServices::getInstance()->getConnectionProvider()->getPrimaryDatabase();
58 $this->res = $this->doQuery( $dbw );
59 }
60
71 abstract public function updateChangeTagsOnAll(
72 array $tagsToAdd,
73 array $tagsToRemove,
74 ?string $params,
75 string $reason,
76 Authority $performer
77 );
78}
79
81class_alias( ChangeTagsList::class, 'ChangeTagsList' );
reloadFromPrimary()
Reload the list data from the primary DB.
__construct(IContextSource $context, PageIdentity $page, array $ids)
updateChangeTagsOnAll(array $tagsToAdd, array $tagsToRemove, ?string $params, string $reason, Authority $performer)
Add/remove change tags from all the items in the list.
static factory( $typeName, IContextSource $context, PageIdentity $page, array $ids)
Create a ChangeTagsList instance of the given type.
static getInstance()
Returns the global default instance of the top level service locator.
List for revision table items for a single page.
doQuery( $db)
Do the DB query to iterate through the objects.
Interface for objects which can provide a MediaWiki context on request.
Interface for objects (potentially) representing an editable wiki page.
This interface represents the authority associated with the current execution context,...
Definition Authority.php:23