MediaWiki REL1_40
LegacyLogFormatter.php
Go to the documentation of this file.
1<?php
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() {
74 $action = LogPage::actionText(
75 $entry->getType(),
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}
This class formats all log entries for log types which have not been converted to the new system.
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.
getComment()
Gets the user provided comment.
Implements the default log formatting.
LogEntryBase $entry
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
getPerformerElement()
Provides the name of the user who performed the log action.
getParameters()
Get the extra parameters stored for this message.
getTarget()
Get the target page of this action.
getSubtype()
The log subtype.
getType()
The main log type.