MediaWiki
REL1_40
MergeLogFormatter.php
Go to the documentation of this file.
1
<?php
25
use
MediaWiki\Title\Title
;
26
32
class
MergeLogFormatter
extends
LogFormatter
{
33
public
function
getPreloadTitles
() {
34
$params = $this->
extractParameters
();
35
36
return
[ Title::newFromText( $params[3] ) ];
37
}
38
39
protected
function
getMessageParameters
() {
40
$params = parent::getMessageParameters();
41
$oldname = $this->
makePageLink
( $this->entry->getTarget(), [
'redirect'
=>
'no'
] );
42
$newname = $this->
makePageLink
( Title::newFromText( $params[3] ) );
43
$params[2] =
Message::rawParam
( $oldname );
44
$params[3] =
Message::rawParam
( $newname );
45
$params[4] = $this->context->getLanguage()
46
->userTimeAndDate( $params[4], $this->context->getUser() );
47
return
$params;
48
}
49
50
public
function
getActionLinks
() {
51
if
( $this->entry->isDeleted( LogPage::DELETED_ACTION )
// Action is hidden
52
|| !$this->context->getAuthority()->isAllowed(
'mergehistory'
)
53
) {
54
return
''
;
55
}
56
57
// Show unmerge link
58
$params = $this->
extractParameters
();
59
$revert = $this->
getLinkRenderer
()->makeKnownLink(
60
SpecialPage::getTitleFor
(
'MergeHistory'
),
61
$this->
msg
(
'revertmerge'
)->text(),
62
[],
63
[
64
'target'
=> $params[3],
65
'dest'
=> $this->entry->getTarget()->getPrefixedDBkey(),
66
'mergepoint'
=> $params[4],
67
'submitted'
=> 1
// show the revisions immediately
68
]
69
);
70
71
return
$this->
msg
(
'parentheses'
)->rawParams( $revert )->escaped();
72
}
73
74
protected
function
getParametersForApi
() {
75
$entry
= $this->entry;
76
$params =
$entry
->
getParameters
();
77
78
static
$map = [
79
'4:title:dest'
,
80
'5:timestamp:mergepoint'
,
81
'4::dest'
=>
'4:title:dest'
,
82
'5::mergepoint'
=>
'5:timestamp:mergepoint'
,
83
];
84
foreach
( $map as $index => $key ) {
85
if
( isset( $params[$index] ) ) {
86
$params[$key] = $params[$index];
87
unset( $params[$index] );
88
}
89
}
90
91
return
$params;
92
}
93
}
LogFormatter
Implements the default log formatting.
Definition
LogFormatter.php:47
LogFormatter\$entry
LogEntryBase $entry
Definition
LogFormatter.php:87
LogFormatter\getLinkRenderer
getLinkRenderer()
Definition
LogFormatter.php:151
LogFormatter\msg
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
Definition
LogFormatter.php:781
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:683
LogFormatter\extractParameters
extractParameters()
Extracts the optional extra parameters for use in action messages.
Definition
LogFormatter.php:529
MediaWiki\Title\Title
Represents a title within MediaWiki.
Definition
Title.php:82
MergeLogFormatter
This class formats merge log entries.
Definition
MergeLogFormatter.php:32
MergeLogFormatter\getPreloadTitles
getPreloadTitles()
Definition
MergeLogFormatter.php:33
MergeLogFormatter\getActionLinks
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.
Definition
MergeLogFormatter.php:50
MergeLogFormatter\getMessageParameters
getMessageParameters()
Formats parameters intended for action message from array of all parameters.
Definition
MergeLogFormatter.php:39
MergeLogFormatter\getParametersForApi
getParametersForApi()
Get the array of parameters, converted from legacy format if necessary.
Definition
MergeLogFormatter.php:74
Message\rawParam
static rawParam( $raw)
Definition
Message.php:1135
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
LogEntry\getParameters
getParameters()
Get the extra parameters stored for this message.
includes
logging
MergeLogFormatter.php
Generated on Thu Jun 27 2024 14:03:23 for MediaWiki by
1.10.0