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