MediaWiki master
RevDelLogList.php
Go to the documentation of this file.
1<?php
9
20
25
26 protected const SUPPRESS_BIT = LogPage::DELETED_RESTRICTED;
27
29 private $commentStore;
30 private LogFormatterFactory $logFormatterFactory;
31
41 public function __construct(
42 IContextSource $context,
44 array $ids,
45 LBFactory $lbFactory,
46 CommentStore $commentStore,
47 LogFormatterFactory $logFormatterFactory
48 ) {
49 parent::__construct( $context, $page, $ids, $lbFactory );
50 $this->commentStore = $commentStore;
51 $this->logFormatterFactory = $logFormatterFactory;
52 }
53
55 public function getType() {
56 return 'logging';
57 }
58
60 public static function getRelationType() {
61 return 'log_id';
62 }
63
65 public static function getRestriction() {
66 return 'deletelogentry';
67 }
68
70 public static function getRevdelConstant() {
71 return LogPage::DELETED_ACTION;
72 }
73
75 public static function suggestTarget( $target, array $ids ) {
76 $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
77 $result = $dbr->newSelectQueryBuilder()
78 ->select( 'log_type' )
79 ->distinct()
80 ->from( 'logging' )
81 ->where( [ 'log_id' => $ids ] )
82 ->caller( __METHOD__ )->fetchResultSet();
83 if ( $result->numRows() == 1 ) {
84 // If there's only one type, the target can be set to include it.
85 return SpecialPage::getTitleFor( 'Log', $result->current()->log_type );
86 }
87
88 return SpecialPage::getTitleFor( 'Log' );
89 }
90
95 public function doQuery( $db ) {
96 $ids = array_map( 'intval', $this->ids );
97 $queryBuilder = $db->newSelectQueryBuilder()
98 ->select( [
99 'log_id',
100 'log_type',
101 'log_action',
102 'log_timestamp',
103 'log_actor',
104 'log_namespace',
105 'log_title',
106 'log_page',
107 'log_params',
108 'log_deleted',
109 'log_user' => 'actor_user',
110 'log_user_text' => 'actor_name',
111 'log_comment_text' => 'comment_log_comment.comment_text',
112 'log_comment_data' => 'comment_log_comment.comment_data',
113 'log_comment_cid' => 'comment_log_comment.comment_id'
114 ] )
115 ->from( 'logging' )
116 ->join( 'actor', null, 'actor_id=log_actor' )
117 ->join( 'comment', 'comment_log_comment', 'comment_log_comment.comment_id = log_comment_id' )
118 ->where( [ 'log_id' => $ids ] )
119 ->orderBy( [ 'log_timestamp', 'log_id' ], SelectQueryBuilder::SORT_DESC );
120
121 MediaWikiServices::getInstance()->getChangeTagsStore()->modifyDisplayQueryBuilder( $queryBuilder, 'logging' );
122
123 return $queryBuilder->caller( __METHOD__ )->fetchResultSet();
124 }
125
127 public function newItem( $row ) {
128 return new RevDelLogItem(
129 $this,
130 $row,
131 $this->commentStore,
132 MediaWikiServices::getInstance()->getConnectionProvider(),
133 $this->logFormatterFactory
134 );
135 }
136
138 public function getLogAction() {
139 return 'event';
140 }
141
143 public function getLogParams( $params ) {
144 return [
145 '4::ids' => $params['ids'],
146 '5::ofield' => $params['oldBits'],
147 '6::nfield' => $params['newBits'],
148 ];
149 }
150}
151
153class_alias( RevDelLogList::class, 'RevDelLogList' );
Handle database storage of comments such as edit summaries and log reasons.
Class to simplify the use of log pages.
Definition LogPage.php:35
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
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
__construct(IContextSource $context, PageIdentity $page, array $ids, LBFactory $lbFactory, CommentStore $commentStore, LogFormatterFactory $logFormatterFactory)
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.