MediaWiki
REL1_41
LegacyLogFormatter.php
Go to the documentation of this file.
1
<?php
26
use
MediaWiki\HookContainer\HookRunner
;
27
use
MediaWiki\MediaWikiServices
;
28
38
class
LegacyLogFormatter
extends
LogFormatter
{
48
private
$comment =
null
;
49
57
private
$revert =
null
;
58
59
public
function
getComment
() {
60
$this->comment ??= parent::getComment();
61
62
// Make sure we execute the LogLine hook so that we immediately return
63
// the correct value.
64
if
( $this->revert ===
null
) {
65
$this->
getActionLinks
();
66
}
67
68
return
$this->comment;
69
}
70
75
protected
function
getActionMessage
() {
76
$entry
=
$this->entry
;
77
$action = LogPage::actionText(
78
$entry
->
getType
(),
79
$entry
->
getSubtype
(),
80
$entry
->
getTarget
(),
81
$this->plaintext ?
null
: $this->context->getSkin(),
82
(array)
$entry
->
getParameters
(),
83
!$this->plaintext
// whether to filter [[]] links
84
);
85
86
$performer = $this->
getPerformerElement
();
87
if
( !$this->irctext ) {
88
$sep = $this->
msg
(
'word-separator'
);
89
$sep = $this->plaintext ? $sep->text() : $sep->escaped();
90
$action = $performer . $sep . $action;
91
}
92
93
return
$action;
94
}
95
96
public
function
getActionLinks
() {
97
if
( $this->revert !==
null
) {
98
return
$this->revert;
99
}
100
101
if
( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
102
$this->revert =
''
;
103
return
$this->revert;
104
}
105
106
$title = $this->entry->getTarget();
107
$type = $this->entry->getType();
108
$subtype = $this->entry->getSubtype();
109
110
// Do nothing. The implementation is handled by the hook modifying the
111
// passed-by-ref parameters. This also changes the default value so that
112
// getComment() and getActionLinks() do not call them indefinitely.
113
$this->revert =
''
;
114
115
// This is to populate the $comment member of this instance so that it
116
// can be modified when calling the hook just below.
117
if
( $this->comment ===
null
) {
118
$this->
getComment
();
119
}
120
121
$params = $this->entry->getParameters();
122
123
(
new
HookRunner
( MediaWikiServices::getInstance()->getHookContainer() ) )->onLogLine(
124
$type, $subtype, $title, $params, $this->comment, $this->revert, $this->entry->getTimestamp() );
125
126
return
$this->revert;
127
}
128
}
LegacyLogFormatter
This class formats all log entries for log types which have not been converted to the new system.
Definition
LegacyLogFormatter.php:38
LegacyLogFormatter\getActionLinks
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.
Definition
LegacyLogFormatter.php:96
LegacyLogFormatter\getActionMessage
getActionMessage()
Definition
LegacyLogFormatter.php:75
LegacyLogFormatter\getComment
getComment()
Gets the user provided comment.
Definition
LegacyLogFormatter.php:59
LogFormatter
Implements the default log formatting.
Definition
LogFormatter.php:49
LogFormatter\$entry
LogEntryBase $entry
Definition
LogFormatter.php:89
LogFormatter\msg
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
Definition
LogFormatter.php:790
LogFormatter\getPerformerElement
getPerformerElement()
Provides the name of the user who performed the log action.
Definition
LogFormatter.php:718
MediaWiki\HookContainer\HookRunner
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
Definition
HookRunner.php:567
MediaWiki\MediaWikiServices
Service locator for MediaWiki core services.
Definition
MediaWikiServices.php:232
LogEntry\getParameters
getParameters()
Get the extra parameters stored for this message.
LogEntry\getTarget
getTarget()
Get the target page of this action.
LogEntry\getSubtype
getSubtype()
The log subtype.
LogEntry\getType
getType()
The main log type.
includes
logging
LegacyLogFormatter.php
Generated on Wed Nov 27 2024 07:24:00 for MediaWiki by
1.10.0