MediaWiki
REL1_35
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
if
( $this->comment ===
null
) {
58
$this->comment = parent::getComment();
59
}
60
61
// Make sure we execute the LogLine hook so that we immediately return
62
// the correct value.
63
if
( $this->revert ===
null
) {
64
$this->
getActionLinks
();
65
}
66
67
return
$this->comment
;
68
}
69
74
protected
function
getActionMessage
() {
75
$entry
=
$this->entry
;
76
$action =
LogPage::actionText
(
77
$entry
->
getType
(),
78
$entry
->
getSubtype
(),
79
$entry
->
getTarget
(),
80
$this->plaintext ?
null
: $this->context->getSkin(),
81
(array)
$entry
->
getParameters
(),
82
!$this->plaintext
// whether to filter [[]] links
83
);
84
85
$performer = $this->
getPerformerElement
();
86
if
( !$this->irctext ) {
87
$sep = $this->
msg
(
'word-separator'
);
88
$sep = $this->plaintext ? $sep->text() : $sep->escaped();
89
$action = $performer . $sep . $action;
90
}
91
92
return
$action;
93
}
94
95
public
function
getActionLinks
() {
96
if
( $this->revert !==
null
) {
97
return
$this->revert
;
98
}
99
100
if
( $this->entry->isDeleted(
LogPage::DELETED_ACTION
) ) {
101
$this->revert =
''
;
102
return
$this->revert
;
103
}
104
105
$title
= $this->entry->getTarget();
106
$type
= $this->entry->getType();
107
$subtype = $this->entry->getSubtype();
108
109
// Do nothing. The implementation is handled by the hook modifiying the
110
// passed-by-ref parameters. This also changes the default value so that
111
// getComment() and getActionLinks() do not call them indefinitely.
112
$this->revert =
''
;
113
114
// This is to populate the $comment member of this instance so that it
115
// can be modified when calling the hook just below.
116
if
( $this->comment ===
null
) {
117
$this->
getComment
();
118
}
119
120
$params = $this->entry->getParameters();
121
122
Hooks::runner()->onLogLine(
$type
, $subtype,
$title
, $params, $this->comment,
123
$this->revert, $this->entry->getTimestamp() );
124
125
return
$this->revert
;
126
}
127
}
LegacyLogFormatter
This class formats all log entries for log types which have not been converted to the new system.
Definition
LegacyLogFormatter.php:35
LegacyLogFormatter\$revert
string null $revert
Cache for the result of getActionLinks() so that it does not need to run multiple times depending on ...
Definition
LegacyLogFormatter.php:54
LegacyLogFormatter\$comment
string null $comment
Backward compatibility for extension changing the comment from the LogLine hook.
Definition
LegacyLogFormatter.php:45
LegacyLogFormatter\getActionLinks
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.
Definition
LegacyLogFormatter.php:95
LegacyLogFormatter\getActionMessage
getActionMessage()
Definition
LegacyLogFormatter.php:74
LegacyLogFormatter\getComment
getComment()
Gets the user provided comment Stable to override.
Definition
LegacyLogFormatter.php:56
LogFormatter
Implements the default log formatting.
Definition
LogFormatter.php:40
LogFormatter\$entry
LogEntryBase $entry
Definition
LogFormatter.php:79
LogFormatter\msg
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
Definition
LogFormatter.php:775
LogFormatter\getPerformerElement
getPerformerElement()
Provides the name of the user who performed the log action.
Definition
LogFormatter.php:704
LogPage\actionText
static actionText( $type, $action, $title=null, $skin=null, $params=[], $filterWikilinks=false)
Generate text for a log entry.
Definition
LogPage.php:232
LogPage\DELETED_ACTION
const DELETED_ACTION
Definition
LogPage.php:38
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:52
$title
$title
Definition
testCompression.php:38
includes
logging
LegacyLogFormatter.php
Generated on Sat Apr 6 2024 00:07:30 for MediaWiki by
1.9.8