MediaWiki
REL1_40
RevDelLogList.php
Go to the documentation of this file.
1
<?php
22
use
MediaWiki\CommentStore\CommentStore
;
23
use
MediaWiki\Page\PageIdentity
;
24
use
MediaWiki\Revision\RevisionRecord
;
25
use
Wikimedia\Rdbms\IDatabase
;
26
use
Wikimedia\Rdbms\LBFactory
;
27
31
class
RevDelLogList
extends
RevDelList
{
32
34
private
$commentStore;
35
44
public
function
__construct
(
45
IContextSource
$context,
46
PageIdentity
$page
,
47
array
$ids
,
48
LBFactory
$lbFactory,
49
CommentStore
$commentStore
50
) {
51
parent::__construct( $context,
$page
,
$ids
, $lbFactory );
52
$this->commentStore = $commentStore;
53
}
54
55
public
function
getType
() {
56
return
'logging'
;
57
}
58
59
public
static
function
getRelationType
() {
60
return
'log_id'
;
61
}
62
63
public
static
function
getRestriction
() {
64
return
'deletelogentry'
;
65
}
66
67
public
static
function
getRevdelConstant
() {
68
return
LogPage::DELETED_ACTION;
69
}
70
71
public
static
function
suggestTarget
( $target, array
$ids
) {
72
$result =
wfGetDB
(
DB_REPLICA
)->select(
'logging'
,
73
'log_type'
,
74
[
'log_id'
=>
$ids
],
75
__METHOD__,
76
[
'DISTINCT'
]
77
);
78
if
( $result->numRows() == 1 ) {
79
// If there's only one type, the target can be set to include it.
80
return
SpecialPage::getTitleFor
(
'Log'
, $result->current()->log_type );
81
}
82
83
return
SpecialPage::getTitleFor
(
'Log'
);
84
}
85
90
public
function
doQuery
( $db ) {
91
$ids
= array_map(
'intval'
, $this->ids );
92
93
$commentQuery = $this->commentStore->getJoin(
'log_comment'
);
94
95
$queryInfo = [
96
'tables'
=> [
'logging'
,
'actor'
] + $commentQuery[
'tables'
],
97
'fields'
=> [
98
'log_id'
,
99
'log_type'
,
100
'log_action'
,
101
'log_timestamp'
,
102
'log_actor'
,
103
'log_namespace'
,
104
'log_title'
,
105
'log_page'
,
106
'log_params'
,
107
'log_deleted'
,
108
'log_user'
=>
'actor_user'
,
109
'log_user_text'
=>
'actor_name'
110
] + $commentQuery[
'fields'
],
111
'conds'
=> [
'log_id'
=>
$ids
],
112
'options'
=> [
'ORDER BY'
=> [
'log_timestamp DESC'
,
'log_id DESC'
] ],
113
'join_conds'
=> [
114
'actor'
=> [
'JOIN'
,
'actor_id=log_actor'
]
115
] + $commentQuery[
'joins'
],
116
];
117
118
ChangeTags::modifyDisplayQuery
(
119
$queryInfo[
'tables'
],
120
$queryInfo[
'fields'
],
121
$queryInfo[
'conds'
],
122
$queryInfo[
'join_conds'
],
123
$queryInfo[
'options'
],
124
''
125
);
126
127
return
$db->select(
128
$queryInfo[
'tables'
],
129
$queryInfo[
'fields'
],
130
$queryInfo[
'conds'
],
131
__METHOD__,
132
$queryInfo[
'options'
],
133
$queryInfo[
'join_conds'
]
134
);
135
}
136
137
public
function
newItem
( $row ) {
138
return
new
RevDelLogItem
( $this, $row, $this->commentStore );
139
}
140
141
public
function
getSuppressBit
() {
142
return
RevisionRecord::DELETED_RESTRICTED;
143
}
144
145
public
function
getLogAction
() {
146
return
'event'
;
147
}
148
149
public
function
getLogParams
( $params ) {
150
return
[
151
'4::ids'
=> $params[
'ids'
],
152
'5::ofield'
=> $params[
'oldBits'
],
153
'6::nfield'
=> $params[
'newBits'
],
154
];
155
}
156
}
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition
GlobalFunctions.php:1891
ChangeTags\modifyDisplayQuery
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='', bool $exclude=false)
Applies all tags-related changes to a query.
Definition
ChangeTags.php:904
MediaWiki\CommentStore\CommentStore
Handle database storage of comments such as edit summaries and log reasons.
Definition
CommentStore.php:44
MediaWiki\Revision\RevisionRecord
Page revision base class.
Definition
RevisionRecord.php:47
RevDelList
Definition
RevDelList.php:38
RevDelLogItem
Item class for a logging table row.
Definition
RevDelLogItem.php:29
RevDelLogList
List for logging table items.
Definition
RevDelLogList.php:31
RevDelLogList\getLogParams
getLogParams( $params)
Get log parameter array.
Definition
RevDelLogList.php:149
RevDelLogList\getLogAction
getLogAction()
Get the log action for this list type.
Definition
RevDelLogList.php:145
RevDelLogList\getRestriction
static getRestriction()
Get the user right required for this list type Override this function.
Definition
RevDelLogList.php:63
RevDelLogList\getSuppressBit
getSuppressBit()
Get the integer value of the flag used for suppression.
Definition
RevDelLogList.php:141
RevDelLogList\getRelationType
static getRelationType()
Get the DB field name associated with the ID list.
Definition
RevDelLogList.php:59
RevDelLogList\getType
getType()
Get the internal type name of this list.
Definition
RevDelLogList.php:55
RevDelLogList\doQuery
doQuery( $db)
Definition
RevDelLogList.php:90
RevDelLogList\suggestTarget
static suggestTarget( $target, array $ids)
Suggest a target for the revision deletion Optionally override this function.
Definition
RevDelLogList.php:71
RevDelLogList\getRevdelConstant
static getRevdelConstant()
Get the revision deletion constant for this list type Override this function.
Definition
RevDelLogList.php:67
RevDelLogList\newItem
newItem( $row)
Create an item object from a DB result row.
Definition
RevDelLogList.php:137
RevDelLogList\__construct
__construct(IContextSource $context, PageIdentity $page, array $ids, LBFactory $lbFactory, CommentStore $commentStore)
Definition
RevDelLogList.php:44
RevisionListBase\$page
PageIdentity $page
Definition
RevisionListBase.php:35
RevisionListBase\$ids
int[] null $ids
Definition
RevisionListBase.php:38
SpecialPage\getTitleFor
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,...
Definition
SpecialPage.php:132
Wikimedia\Rdbms\LBFactory
Definition
LBFactory.php:41
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition
IContextSource.php:60
MediaWiki\Page\PageIdentity
Interface for objects (potentially) representing an editable wiki page.
Definition
PageIdentity.php:65
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition
IDatabase.php:36
DB_REPLICA
const DB_REPLICA
Definition
defines.php:26
includes
revisiondelete
RevDelLogList.php
Generated on Thu Jun 27 2024 14:04:03 for MediaWiki by
1.10.0