MediaWiki master
ChangeTagsList.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\ChangeTags;
22
23use InvalidArgumentException;
30
40abstract class ChangeTagsList extends RevisionListBase {
41 public function __construct( IContextSource $context, PageIdentity $page, array $ids ) {
42 parent::__construct( $context, $page );
43 $this->ids = $ids;
44 }
45
56 public static function factory( $typeName, IContextSource $context,
58 ) {
59 switch ( $typeName ) {
60 case 'revision':
61 $className = ChangeTagsRevisionList::class;
62 break;
63 case 'logentry':
64 $className = ChangeTagsLogList::class;
65 break;
66 default:
67 throw new InvalidArgumentException( "Class $typeName requested, but does not exist" );
68 }
69
70 return new $className( $context, $page, $ids );
71 }
72
76 public function reloadFromPrimary() {
77 $dbw = MediaWikiServices::getInstance()->getConnectionProvider()->getPrimaryDatabase();
78 $this->res = $this->doQuery( $dbw );
79 }
80
91 abstract public function updateChangeTagsOnAll(
92 array $tagsToAdd,
93 array $tagsToRemove,
94 ?string $params,
95 string $reason,
96 Authority $performer
97 );
98}
99
101class_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.
Service locator for MediaWiki core services.
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.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:54
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:37