MediaWiki
REL1_40
LegacyLogFormatter.php
Go to the documentation of this file.
1
<?php
35
class
LegacyLogFormatter
extends
LogFormatter
{
45
private
$comment =
null
;
46
54
private
$revert =
null
;
55
56
public
function
getComment
() {
57
$this->comment ??= parent::getComment();
58
59
// Make sure we execute the LogLine hook so that we immediately return
60
// the correct value.
61
if
( $this->revert ===
null
) {
62
$this->
getActionLinks
();
63
}
64
65
return
$this->comment;
66
}
67
72
protected
function
getActionMessage
() {
73
$entry
=
$this->entry
;
74
$action = LogPage::actionText(
75
$entry
->
getType
(),
76
$entry
->
getSubtype
(),
77
$entry
->
getTarget
(),
78
$this->plaintext ?
null
: $this->context->getSkin(),
79
(array)
$entry
->
getParameters
(),
80
!$this->plaintext
// whether to filter [[]] links
81
);
82
83
$performer = $this->
getPerformerElement
();
84
if
( !$this->irctext ) {
85
$sep = $this->
msg
(
'word-separator'
);
86
$sep = $this->plaintext ? $sep->text() : $sep->escaped();
87
$action = $performer . $sep . $action;
88
}
89
90
return
$action;
91
}
92
93
public
function
getActionLinks
() {
94
if
( $this->revert !==
null
) {
95
return
$this->revert;
96
}
97
98
if
( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
99
$this->revert =
''
;
100
return
$this->revert;
101
}
102
103
$title
= $this->entry->getTarget();
104
$type
= $this->entry->getType();
105
$subtype = $this->entry->getSubtype();
106
107
// Do nothing. The implementation is handled by the hook modifying the
108
// passed-by-ref parameters. This also changes the default value so that
109
// getComment() and getActionLinks() do not call them indefinitely.
110
$this->revert =
''
;
111
112
// This is to populate the $comment member of this instance so that it
113
// can be modified when calling the hook just below.
114
if
( $this->comment ===
null
) {
115
$this->
getComment
();
116
}
117
118
$params = $this->entry->getParameters();
119
120
Hooks::runner()->onLogLine(
$type
, $subtype,
$title
, $params, $this->comment,
121
$this->revert, $this->entry->getTimestamp() );
122
123
return
$this->revert;
124
}
125
}
LegacyLogFormatter
This class formats all log entries for log types which have not been converted to the new system.
Definition
LegacyLogFormatter.php:35
LegacyLogFormatter\getActionLinks
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.
Definition
LegacyLogFormatter.php:93
LegacyLogFormatter\getActionMessage
getActionMessage()
Definition
LegacyLogFormatter.php:72
LegacyLogFormatter\getComment
getComment()
Gets the user provided comment.
Definition
LegacyLogFormatter.php:56
LogFormatter
Implements the default log formatting.
Definition
LogFormatter.php:47
LogFormatter\$entry
LogEntryBase $entry
Definition
LogFormatter.php:87
LogFormatter\msg
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
Definition
LogFormatter.php:781
LogFormatter\getPerformerElement
getPerformerElement()
Provides the name of the user who performed the log action.
Definition
LogFormatter.php:709
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.
$type
$type
Definition
testCompression.php:53
$title
$title
Definition
testCompression.php:39
includes
logging
LegacyLogFormatter.php
Generated on Thu Jun 27 2024 14:03:22 for MediaWiki by
1.10.0