MediaWiki master
RevDelLogList.php
Go to the documentation of this file.
1<?php
9
21
26
27 protected const SUPPRESS_BIT = LogPage::DELETED_RESTRICTED;
28
32 public function __construct(
33 IContextSource $context,
35 array $ids,
36 LBFactory $lbFactory,
37 private readonly CommentStore $commentStore,
38 private readonly LogFormatterFactory $logFormatterFactory,
39 private readonly ChangeTagsFormatter $changeTagsFormatter,
40 ) {
41 parent::__construct( $context, $page, $ids, $lbFactory );
42 }
43
45 public function getType() {
46 return 'logging';
47 }
48
50 public static function getRelationType() {
51 return 'log_id';
52 }
53
55 public static function getRestriction() {
56 return 'deletelogentry';
57 }
58
60 public static function getRevdelConstant() {
61 return LogPage::DELETED_ACTION;
62 }
63
65 public static function suggestTarget( $target, array $ids ) {
66 $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
67 $result = $dbr->newSelectQueryBuilder()
68 ->select( 'log_type' )
69 ->distinct()
70 ->from( 'logging' )
71 ->where( [ 'log_id' => $ids ] )
72 ->caller( __METHOD__ )->fetchResultSet();
73 if ( $result->numRows() == 1 ) {
74 // If there's only one type, the target can be set to include it.
75 return SpecialPage::getTitleFor( 'Log', $result->current()->log_type );
76 }
77
78 return SpecialPage::getTitleFor( 'Log' );
79 }
80
85 public function doQuery( $db ) {
86 $ids = array_map( 'intval', $this->ids );
87 $queryBuilder = $db->newSelectQueryBuilder()
88 ->select( [
89 'log_id',
90 'log_type',
91 'log_action',
92 'log_timestamp',
93 'log_actor',
94 'log_namespace',
95 'log_title',
96 'log_page',
97 'log_params',
98 'log_deleted',
99 'log_user' => 'actor_user',
100 'log_user_text' => 'actor_name',
101 'log_comment_text' => 'comment_log_comment.comment_text',
102 'log_comment_data' => 'comment_log_comment.comment_data',
103 'log_comment_cid' => 'comment_log_comment.comment_id'
104 ] )
105 ->from( 'logging' )
106 ->join( 'actor', null, 'actor_id=log_actor' )
107 ->join( 'comment', 'comment_log_comment', 'comment_log_comment.comment_id = log_comment_id' )
108 ->where( [ 'log_id' => $ids ] )
109 ->orderBy( [ 'log_timestamp', 'log_id' ], SelectQueryBuilder::SORT_DESC );
110
111 MediaWikiServices::getInstance()->getChangeTagsStore()
112 ->addTagsToDisplayQuery( $queryBuilder, 'logging', $this->getAuthority() );
113
114 return $queryBuilder->caller( __METHOD__ )->fetchResultSet();
115 }
116
118 public function newItem( $row ) {
119 return new RevDelLogItem(
120 $this,
121 $row,
122 $this->commentStore,
123 MediaWikiServices::getInstance()->getConnectionProvider(),
124 $this->logFormatterFactory,
125 $this->changeTagsFormatter
126 );
127 }
128
130 public function getLogAction() {
131 return 'event';
132 }
133
135 public function getLogParams( $params ) {
136 return [
137 '4::ids' => $params['ids'],
138 '5::ofield' => $params['oldBits'],
139 '6::nfield' => $params['newBits'],
140 ];
141 }
142}
143
145class_alias( RevDelLogList::class, 'RevDelLogList' );
Formats change tags for display in HTML and use filter dropdown menus.
Handle database storage of comments such as edit summaries and log reasons.
Class to simplify the use of log pages.
Definition LogPage.php:34
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.
Item class for a logging table row.
List for logging table items.
getType()
Get the internal type name of this list.Equal to the table name. Override this function....
newItem( $row)
Create an item object from a DB result row.RevisionItemBase
getLogAction()
Get the log action for this list type.string
static getRestriction()
Get the user right required for this list type Override this function.1.22 string|null
getLogParams( $params)
Get log parameter array.array
__construct(IContextSource $context, PageIdentity $page, array $ids, LBFactory $lbFactory, private readonly CommentStore $commentStore, private readonly LogFormatterFactory $logFormatterFactory, private readonly ChangeTagsFormatter $changeTagsFormatter,)
static getRelationType()
Get the DB field name associated with the ID list.This used to populate the log_search table for find...
static getRevdelConstant()
Get the revision deletion constant for this list type Override this function.1.22 int|null
static suggestTarget( $target, array $ids)
Suggest a target for the revision deletion Optionally override this function.1.22 Title|null
Parent class for all special pages.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Build SELECT queries with a fluent interface.
Interface for objects which can provide a MediaWiki context on request.
Interface for objects (potentially) representing an editable wiki page.
Result wrapper for grabbing data queried from an IDatabase object.