MediaWiki REL1_37
RevDelLogList.php
Go to the documentation of this file.
1<?php
26
31
34
43 public function __construct(
45 PageIdentity $page,
46 array $ids,
49 ) {
50 parent::__construct( $context, $page, $ids, $lbFactory );
51 $this->commentStore = $commentStore;
52 }
53
54 public function getType() {
55 return 'logging';
56 }
57
58 public static function getRelationType() {
59 return 'log_id';
60 }
61
62 public static function getRestriction() {
63 return 'deletelogentry';
64 }
65
66 public static function getRevdelConstant() {
68 }
69
70 public static function suggestTarget( $target, array $ids ) {
71 $result = wfGetDB( DB_REPLICA )->select( 'logging',
72 'log_type',
73 [ 'log_id' => $ids ],
74 __METHOD__,
75 [ 'DISTINCT' ]
76 );
77 if ( $result->numRows() == 1 ) {
78 // If there's only one type, the target can be set to include it.
79 return SpecialPage::getTitleFor( 'Log', $result->current()->log_type );
80 }
81
82 return SpecialPage::getTitleFor( 'Log' );
83 }
84
89 public function doQuery( $db ) {
90 $ids = array_map( 'intval', $this->ids );
91
92 $commentQuery = $this->commentStore->getJoin( 'log_comment' );
93
94 return $db->select(
95 [ 'logging', 'actor' ] + $commentQuery['tables'],
96 [
97 'log_id',
98 'log_type',
99 'log_action',
100 'log_timestamp',
101 'log_actor',
102 'log_namespace',
103 'log_title',
104 'log_page',
105 'log_params',
106 'log_deleted',
107 'log_user' => 'actor_user',
108 'log_user_text' => 'actor_name'
109 ] + $commentQuery['fields'],
110 [ 'log_id' => $ids ],
111 __METHOD__,
112 [ 'ORDER BY' => 'log_id DESC' ],
113 [
114 'actor' => [ 'JOIN', 'actor_id=log_actor' ]
115 ] + $commentQuery['joins']
116 );
117 }
118
119 public function newItem( $row ) {
120 return new RevDelLogItem( $this, $row, $this->commentStore );
121 }
122
123 public function getSuppressBit() {
124 return RevisionRecord::DELETED_RESTRICTED;
125 }
126
127 public function getLogAction() {
128 return 'event';
129 }
130
131 public function getLogParams( $params ) {
132 return [
133 '4::ids' => $params['ids'],
134 '5::ofield' => $params['oldBits'],
135 '6::nfield' => $params['newBits'],
136 ];
137 }
138}
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Handle database storage of comments such as edit summaries and log reasons.
IContextSource $context
const DELETED_ACTION
Definition LogPage.php:39
Page revision base class.
LBFactory $lbFactory
Item class for a logging table row.
List for logging table items.
getLogParams( $params)
Get log parameter array.
getLogAction()
Get the log action for this list type.
static getRestriction()
Get the user right required for this list type Override this function.
getSuppressBit()
Get the integer value of the flag used for suppression.
static getRelationType()
Get the DB field name associated with the ID list.
CommentStore $commentStore
getType()
Get the internal type name of this list.
static suggestTarget( $target, array $ids)
Suggest a target for the revision deletion Optionally override this function.
static getRevdelConstant()
Get the revision deletion constant for this list type Override this function.
newItem( $row)
Create an item object from a DB result row.
__construct(IContextSource $context, PageIdentity $page, array $ids, LBFactory $lbFactory, CommentStore $commentStore)
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,...
An interface for generating database load balancers.
Definition LBFactory.php:42
Interface for objects which can provide a MediaWiki context on request.
Interface for objects (potentially) representing an editable wiki page.
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38
const DB_REPLICA
Definition defines.php:25