MediaWiki
master
MergeLogFormatter.php
Go to the documentation of this file.
1
<?php
25
use
MediaWiki\Message\Message
;
26
use
MediaWiki\SpecialPage\SpecialPage
;
27
use
MediaWiki\Title\Title
;
28
34
class
MergeLogFormatter
extends
LogFormatter
{
35
public
function
getPreloadTitles
() {
36
$params
= $this->
extractParameters
();
37
38
return
[ Title::newFromText(
$params
[3] ) ];
39
}
40
41
protected
function
getMessageParameters
() {
42
$params
= parent::getMessageParameters();
43
$oldname = $this->
makePageLink
( $this->entry->getTarget(), [
'redirect'
=>
'no'
] );
44
$newname = $this->
makePageLink
( Title::newFromText(
$params
[3] ) );
45
$params
[2] = Message::rawParam( $oldname );
46
$params
[3] = Message::rawParam( $newname );
47
$params
[4] = $this->context->getLanguage()
48
->userTimeAndDate(
$params
[4], $this->context->getUser() );
49
return
$params
;
50
}
51
52
public
function
getActionLinks
() {
53
if
( $this->entry->isDeleted( LogPage::DELETED_ACTION )
// Action is hidden
54
|| !$this->context->getAuthority()->isAllowed(
'mergehistory'
)
55
) {
56
return
''
;
57
}
58
59
// Show unmerge link
60
$params
= $this->
extractParameters
();
61
if
( isset(
$params
[5] ) ) {
62
$mergePoint =
$params
[4] .
"|"
.
$params
[5];
63
}
else
{
64
// This is an old log entry from before we recorded the revid separately
65
$mergePoint =
$params
[4];
66
}
67
$revert = $this->
getLinkRenderer
()->makeKnownLink(
68
SpecialPage::getTitleFor(
'MergeHistory'
),
69
$this->
msg
(
'revertmerge'
)->text(),
70
[],
71
[
72
'target'
=>
$params
[3],
73
'dest'
=> $this->entry->getTarget()->getPrefixedDBkey(),
74
'mergepoint'
=> $mergePoint,
75
'submitted'
=> 1
// show the revisions immediately
76
]
77
);
78
79
return
$this->
msg
(
'parentheses'
)->rawParams( $revert )->escaped();
80
}
81
82
protected
function
getParametersForApi
() {
83
$entry
= $this->entry;
84
$params
=
$entry
->
getParameters
();
85
86
static
$map = [
87
'4:title:dest'
,
88
'5:timestamp:mergepoint'
,
89
'4::dest'
=>
'4:title:dest'
,
90
'5::mergepoint'
=>
'5:timestamp:mergepoint'
,
91
'6::mergerevid'
92
];
93
foreach
( $map as $index => $key ) {
94
if
( isset(
$params
[$index] ) ) {
95
$params
[$key] =
$params
[$index];
96
unset(
$params
[$index] );
97
}
98
}
99
100
return
$params
;
101
}
102
}
$params
array $params
The job parameters.
Definition
UploadJobTrait.php:45
LogFormatter
Implements the default log formatting.
Definition
LogFormatter.php:54
LogFormatter\$entry
LogEntryBase $entry
Definition
LogFormatter.php:88
LogFormatter\getLinkRenderer
getLinkRenderer()
Definition
LogFormatter.php:159
LogFormatter\msg
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
Definition
LogFormatter.php:860
LogFormatter\makePageLink
makePageLink(Title $title=null, $parameters=[], $html=null)
Helper to make a link to the page, taking the plaintext value in consideration.
Definition
LogFormatter.php:762
LogFormatter\extractParameters
extractParameters()
Extracts the optional extra parameters for use in action messages.
Definition
LogFormatter.php:601
MediaWiki\Message\Message
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition
Message.php:150
MediaWiki\SpecialPage\SpecialPage
Parent class for all special pages.
Definition
SpecialPage.php:66
MediaWiki\Title\Title
Represents a title within MediaWiki.
Definition
Title.php:78
MergeLogFormatter
This class formats merge log entries.
Definition
MergeLogFormatter.php:34
MergeLogFormatter\getPreloadTitles
getPreloadTitles()
Definition
MergeLogFormatter.php:35
MergeLogFormatter\getActionLinks
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.
Definition
MergeLogFormatter.php:52
MergeLogFormatter\getMessageParameters
getMessageParameters()
Formats parameters intended for action message from array of all parameters.
Definition
MergeLogFormatter.php:41
MergeLogFormatter\getParametersForApi
getParametersForApi()
Get the array of parameters, converted from legacy format if necessary.
Definition
MergeLogFormatter.php:82
LogEntry\getParameters
getParameters()
Get the extra parameters stored for this message.
includes
logging
MergeLogFormatter.php
Generated on Sun Oct 13 2024 19:24:25 for MediaWiki by
1.10.0