MediaWiki master
RevDelArchiveList.php
Go to the documentation of this file.
1<?php
7
8namespace MediaWiki\RevisionDelete;
9
10use MediaWiki\Cache\HTMLCacheUpdater;
11use MediaWiki\ChangeTags\ChangeTagsFormatter;
12use MediaWiki\Context\IContextSource;
13use MediaWiki\DomainEvent\DomainEventDispatcher;
14use MediaWiki\HookContainer\HookContainer;
15use MediaWiki\Logging\LogEntry;
16use MediaWiki\MediaWikiServices;
17use MediaWiki\Page\PageIdentity;
18use MediaWiki\Revision\RevisionStore;
19use MediaWiki\Status\Status;
20use Wikimedia\Rdbms\IResultWrapper;
21use Wikimedia\Rdbms\LBFactory;
22use Wikimedia\Rdbms\SelectQueryBuilder;
23
28
29 public function __construct(
30 IContextSource $context,
32 array $ids,
33 LBFactory $lbFactory,
34 HookContainer $hookContainer,
35 HTMLCacheUpdater $htmlCacheUpdater,
36 private readonly RevisionStore $revisionStore,
37 DomainEventDispatcher $eventDispatcher,
38 private readonly ChangeTagsFormatter $changeTagsFormatter
39 ) {
40 parent::__construct(
41 $context,
42 $page,
43 $ids,
44 $lbFactory,
45 $hookContainer,
46 $htmlCacheUpdater,
47 $this->revisionStore,
48 $eventDispatcher,
49 $this->changeTagsFormatter
50 );
51 }
52
54 public function getType() {
55 return 'archive';
56 }
57
59 public static function getRelationType() {
60 return 'ar_timestamp';
61 }
62
67 public function doQuery( $db ) {
68 $timestamps = [];
69 foreach ( $this->ids as $id ) {
70 $timestamps[] = $db->timestamp( $id );
71 }
72
73 $queryBuilder = $this->revisionStore->newArchiveSelectQueryBuilder( $db )
74 ->joinComment()
75 ->where( [
76 'ar_namespace' => $this->getPage()->getNamespace(),
77 'ar_title' => $this->getPage()->getDBkey(),
78 'ar_timestamp' => $timestamps,
79 ] )
80 ->orderBy( 'ar_timestamp', SelectQueryBuilder::SORT_DESC );
81
82 MediaWikiServices::getInstance()->getChangeTagsStore()
83 ->addTagsToDisplayQuery( $queryBuilder, 'archive', $this->getAuthority() );
84
85 return $queryBuilder->caller( __METHOD__ )->fetchResultSet();
86 }
87
89 public function newItem( $row ) {
90 return new RevDelArchiveItem( $this, $row, $this->changeTagsFormatter );
91 }
92
94 public function doPreCommitUpdates() {
95 return Status::newGood();
96 }
97
99 public function doPostCommitUpdates( array $visibilityChangeMap ) {
100 return Status::newGood();
101 }
102
110 protected function emitEvents(
111 array $bitPars,
112 array $visibilityChangeMap,
113 array $tags,
114 LogEntry $logEntry,
115 bool $suppressed
116 ) {
117 // Do not emit PageHistoryVisibilityChangedEvent for archived revisions.
118 // We could emit a ArchiveVisibilityChangedEvent in the future.
119 // PageHistoryVisibilityChangedEvent and ArchiveVisibilityChangedEvent
120 // should then share a base class, RevisionVisibilityChangedEvent.
121 }
122
123}
124
126class_alias( RevDelArchiveList::class, 'RevDelArchiveList' );
Class to invalidate the CDN and HTMLFileCache entries associated with URLs/titles.
Formats change tags for display in HTML and use filter dropdown menus.
static getInstance()
Returns the global default instance of the top level service locator.
Item class for a archive table row.
List for archive table items, i.e.
doPostCommitUpdates(array $visibilityChangeMap)
A hook for setVisibility(): do any necessary updates post-commit.STUB Status
newItem( $row)
Create an item object from a DB result row.RevisionItemBase
__construct(IContextSource $context, PageIdentity $page, array $ids, LBFactory $lbFactory, HookContainer $hookContainer, HTMLCacheUpdater $htmlCacheUpdater, private readonly RevisionStore $revisionStore, DomainEventDispatcher $eventDispatcher, private readonly ChangeTagsFormatter $changeTagsFormatter)
doPreCommitUpdates()
A hook for setVisibility(): do batch updates pre-commit.STUB Status
emitEvents(array $bitPars, array $visibilityChangeMap, array $tags, LogEntry $logEntry, bool $suppressed)
getType()
Get the internal type name of this list.Equal to the table name. Override this function....
static getRelationType()
Get the DB field name associated with the ID list.This used to populate the log_search table for find...
Service for looking up page revisions.
Interface for objects which can provide a MediaWiki context on request.
Service for sending domain events to registered listeners.
An individual log entry.
Definition LogEntry.php:24
Interface for objects (potentially) representing an editable wiki page.