MediaWiki
REL1_34
MergeLogFormatter.php
Go to the documentation of this file.
1
<?php
25
use
MediaWiki\MediaWikiServices
;
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
|| !MediaWikiServices::getInstance()
53
->getPermissionManager()
54
->userHasRight( $this->context->getUser(),
'mergehistory'
)
55
) {
56
return
''
;
57
}
58
59
// Show unmerge link
60
$params = $this->
extractParameters
();
61
$revert = $this->
getLinkRenderer
()->makeKnownLink(
62
SpecialPage::getTitleFor(
'MergeHistory'
),
63
$this->
msg
(
'revertmerge'
)->text(),
64
[],
65
[
66
'target'
=> $params[3],
67
'dest'
=> $this->entry->getTarget()->getPrefixedDBkey(),
68
'mergepoint'
=> $params[4],
69
'submitted'
=> 1
// show the revisions immediately
70
]
71
);
72
73
return
$this->
msg
(
'parentheses'
)->rawParams( $revert )->escaped();
74
}
75
76
protected
function
getParametersForApi
() {
77
$entry
=
$this->entry
;
78
$params =
$entry
->
getParameters
();
79
80
static
$map = [
81
'4:title:dest'
,
82
'5:timestamp:mergepoint'
,
83
'4::dest'
=>
'4:title:dest'
,
84
'5::mergepoint'
=>
'5:timestamp:mergepoint'
,
85
];
86
foreach
( $map as $index => $key ) {
87
if
( isset( $params[$index] ) ) {
88
$params[$key] = $params[$index];
89
unset( $params[$index] );
90
}
91
}
92
93
return
$params;
94
}
95
}
LogFormatter
Implements the default log formatting.
Definition
LogFormatter.php:38
LogFormatter\$entry
LogEntryBase $entry
Definition
LogFormatter.php:77
LogFormatter\getLinkRenderer
getLinkRenderer()
Definition
LogFormatter.php:136
LogFormatter\msg
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
Definition
LogFormatter.php:761
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:665
LogFormatter\extractParameters
extractParameters()
Extracts the optional extra parameters for use in action messages.
Definition
LogFormatter.php:514
LogPage\DELETED_ACTION
const DELETED_ACTION
Definition
LogPage.php:34
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition
MediaWikiServices.php:117
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 intented 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:76
Message\rawParam
static rawParam( $raw)
Definition
Message.php:1027
LogEntry\getParameters
getParameters()
Get the extra parameters stored for this message.
includes
logging
MergeLogFormatter.php
Generated on Mon Nov 25 2024 16:05:27 for MediaWiki by
1.10.0