MediaWiki
master
LegacyLogFormatter.php
Go to the documentation of this file.
1
<?php
26
use
MediaWiki\HookContainer\HookContainer
;
27
use
MediaWiki\HookContainer\HookRunner
;
28
38
class
LegacyLogFormatter
extends
LogFormatter
{
48
private
$comment =
null
;
49
57
private
$revert =
null
;
58
59
private
HookRunner
$hookRunner;
60
61
public
function
__construct
(
62
LogEntry
$entry
,
63
HookContainer
$hookContainer
64
) {
65
parent::__construct(
$entry
);
66
$this->hookRunner =
new
HookRunner
( $hookContainer );
67
}
68
69
public
function
getComment
() {
70
$this->comment ??= parent::getComment();
71
72
// Make sure we execute the LogLine hook so that we immediately return
73
// the correct value.
74
if
( $this->revert ===
null
) {
75
$this->
getActionLinks
();
76
}
77
78
return
$this->comment;
79
}
80
85
protected
function
getActionMessage
() {
86
$entry
=
$this->entry
;
87
$action = LogPage::actionText(
88
$entry
->
getType
(),
89
$entry
->
getSubtype
(),
90
$entry
->
getTarget
(),
91
$this->plaintext ?
null
: $this->context->getSkin(),
92
(array)
$entry
->
getParameters
(),
93
!$this->plaintext
// whether to filter [[]] links
94
);
95
96
$performer = $this->
getPerformerElement
();
97
if
( !$this->irctext ) {
98
$sep = $this->
msg
(
'word-separator'
);
99
$sep = $this->plaintext ? $sep->text() : $sep->escaped();
100
$action = $performer . $sep . $action;
101
}
102
103
return
$action;
104
}
105
106
public
function
getActionLinks
() {
107
if
( $this->revert !==
null
) {
108
return
$this->revert;
109
}
110
111
if
( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
112
$this->revert =
''
;
113
return
$this->revert;
114
}
115
116
$title = $this->entry->getTarget();
117
$type = $this->entry->getType();
118
$subtype = $this->entry->getSubtype();
119
120
// Do nothing. The implementation is handled by the hook modifying the
121
// passed-by-ref parameters. This also changes the default value so that
122
// getComment() and getActionLinks() do not call them indefinitely.
123
$this->revert =
''
;
124
125
// This is to populate the $comment member of this instance so that it
126
// can be modified when calling the hook just below.
127
if
( $this->comment ===
null
) {
128
$this->
getComment
();
129
}
130
131
$params
= $this->entry->getParameters();
132
133
$this->hookRunner->onLogLine(
134
$type, $subtype, $title,
$params
, $this->comment, $this->revert, $this->entry->getTimestamp() );
135
136
return
$this->revert;
137
}
138
}
$params
array $params
The job parameters.
Definition
UploadJobTrait.php:46
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:106
LegacyLogFormatter\getActionMessage
getActionMessage()
Definition
LegacyLogFormatter.php:85
LegacyLogFormatter\__construct
__construct(LogEntry $entry, HookContainer $hookContainer)
Definition
LegacyLogFormatter.php:61
LegacyLogFormatter\getComment
getComment()
Gets the user provided comment.
Definition
LegacyLogFormatter.php:69
LogFormatter
Implements the default log formatting.
Definition
LogFormatter.php:59
LogFormatter\$entry
LogEntryBase $entry
Definition
LogFormatter.php:93
LogFormatter\msg
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
Definition
LogFormatter.php:867
LogFormatter\getPerformerElement
getPerformerElement()
Provides the name of the user who performed the log action.
Definition
LogFormatter.php:793
MediaWiki\HookContainer\HookContainer
HookContainer class.
Definition
HookContainer.php:57
MediaWiki\HookContainer\HookRunner
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
Definition
HookRunner.php:586
LogEntry
An individual log entry.
Definition
LogEntry.php:35
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 Sat Dec 14 2024 01:25:09 for MediaWiki by
1.10.0