MediaWiki REL1_39
RevDelLogList.php
Go to the documentation of this file.
1<?php
26
31
33 private $commentStore;
34
43 public function __construct(
44 IContextSource $context,
46 array $ids,
47 LBFactory $lbFactory,
48 CommentStore $commentStore
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 $queryInfo = [
95 'tables' => [ 'logging', 'actor' ] + $commentQuery['tables'],
96 'fields' => [
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 'conds' => [ 'log_id' => $ids ],
111 'options' => [ 'ORDER BY' => 'log_id DESC' ],
112 'join_conds' => [
113 'actor' => [ 'JOIN', 'actor_id=log_actor' ]
114 ] + $commentQuery['joins'],
115 ];
116
118 $queryInfo['tables'],
119 $queryInfo['fields'],
120 $queryInfo['conds'],
121 $queryInfo['join_conds'],
122 $queryInfo['options'],
123 ''
124 );
125
126 return $db->select(
127 $queryInfo['tables'],
128 $queryInfo['fields'],
129 $queryInfo['conds'],
130 __METHOD__,
131 $queryInfo['options'],
132 $queryInfo['join_conds']
133 );
134 }
135
136 public function newItem( $row ) {
137 return new RevDelLogItem( $this, $row, $this->commentStore );
138 }
139
140 public function getSuppressBit() {
141 return RevisionRecord::DELETED_RESTRICTED;
142 }
143
144 public function getLogAction() {
145 return 'event';
146 }
147
148 public function getLogParams( $params ) {
149 return [
150 '4::ids' => $params['ids'],
151 '5::ofield' => $params['oldBits'],
152 '6::nfield' => $params['newBits'],
153 ];
154 }
155}
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='', bool $exclude=false)
Applies all tags-related changes to a query.
Handle database storage of comments such as edit summaries and log reasons.
const DELETED_ACTION
Definition LogPage.php:40
Page revision base class.
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.
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,...
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:39
const DB_REPLICA
Definition defines.php:26