MediaWiki
REL1_39
RevDelLogList.php
Go to the documentation of this file.
1
<?php
22
use
MediaWiki\Page\PageIdentity
;
23
use
MediaWiki\Revision\RevisionRecord
;
24
use
Wikimedia\Rdbms\IDatabase
;
25
use
Wikimedia\Rdbms\LBFactory
;
26
30
class
RevDelLogList
extends
RevDelList
{
31
33
private
$commentStore;
34
43
public
function
__construct
(
44
IContextSource
$context,
45
PageIdentity
$page
,
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
() {
67
return
LogPage::DELETED_ACTION
;
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
117
ChangeTags::modifyDisplayQuery
(
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
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition
GlobalFunctions.php:1942
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:906
CommentStore
Handle database storage of comments such as edit summaries and log reasons.
Definition
CommentStore.php:42
LogPage\DELETED_ACTION
const DELETED_ACTION
Definition
LogPage.php:40
MediaWiki\Revision\RevisionRecord
Page revision base class.
Definition
RevisionRecord.php:47
RevDelList
Definition
RevDelList.php:37
RevDelLogItem
Item class for a logging table row.
Definition
RevDelLogItem.php:28
RevDelLogList
List for logging table items.
Definition
RevDelLogList.php:30
RevDelLogList\getLogParams
getLogParams( $params)
Get log parameter array.
Definition
RevDelLogList.php:148
RevDelLogList\getLogAction
getLogAction()
Get the log action for this list type.
Definition
RevDelLogList.php:144
RevDelLogList\getRestriction
static getRestriction()
Get the user right required for this list type Override this function.
Definition
RevDelLogList.php:62
RevDelLogList\getSuppressBit
getSuppressBit()
Get the integer value of the flag used for suppression.
Definition
RevDelLogList.php:140
RevDelLogList\getRelationType
static getRelationType()
Get the DB field name associated with the ID list.
Definition
RevDelLogList.php:58
RevDelLogList\getType
getType()
Get the internal type name of this list.
Definition
RevDelLogList.php:54
RevDelLogList\doQuery
doQuery( $db)
Definition
RevDelLogList.php:89
RevDelLogList\suggestTarget
static suggestTarget( $target, array $ids)
Suggest a target for the revision deletion Optionally override this function.
Definition
RevDelLogList.php:70
RevDelLogList\getRevdelConstant
static getRevdelConstant()
Get the revision deletion constant for this list type Override this function.
Definition
RevDelLogList.php:66
RevDelLogList\newItem
newItem( $row)
Create an item object from a DB result row.
Definition
RevDelLogList.php:136
RevDelLogList\__construct
__construct(IContextSource $context, PageIdentity $page, array $ids, LBFactory $lbFactory, CommentStore $commentStore)
Definition
RevDelLogList.php:43
RevisionListBase\$page
PageIdentity $page
Definition
RevisionListBase.php:34
RevisionListBase\$ids
int[] null $ids
Definition
RevisionListBase.php:37
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:58
MediaWiki\Page\PageIdentity
Interface for objects (potentially) representing an editable wiki page.
Definition
PageIdentity.php:64
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition
IDatabase.php:39
DB_REPLICA
const DB_REPLICA
Definition
defines.php:26
includes
revisiondelete
RevDelLogList.php
Generated on Thu Nov 21 2024 05:24:01 for MediaWiki by
1.10.0