3 * Contains classes for formatting log entries
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @author Niklas Laxström
22 * @license GPL-2.0-or-later
25 use MediaWiki\Linker\LinkRenderer
;
26 use MediaWiki\MediaWikiServices
;
29 * Implements the default log formatting.
31 * Can be overridden by subclassing and setting:
33 * $wgLogActionsHandlers['type/subtype'] = 'class'; or
34 * $wgLogActionsHandlers['type/*'] = 'class';
39 // Audience options for viewing usernames, comments, and actions
41 const FOR_THIS_USER
= 2;
46 * Constructs a new formatter suitable for given entry.
47 * @param LogEntry $entry
48 * @return LogFormatter
50 public static function newFromEntry( LogEntry
$entry ) {
51 global $wgLogActionsHandlers;
52 $fulltype = $entry->getFullType();
53 $wildcard = $entry->getType() . '/*';
56 if ( isset( $wgLogActionsHandlers[$fulltype] ) ) {
57 $handler = $wgLogActionsHandlers[$fulltype];
58 } elseif ( isset( $wgLogActionsHandlers[$wildcard] ) ) {
59 $handler = $wgLogActionsHandlers[$wildcard];
62 if ( $handler !== '' && is_string( $handler ) && class_exists( $handler ) ) {
63 return new $handler( $entry );
66 return new LegacyLogFormatter( $entry );
70 * Handy shortcut for constructing a formatter directly from
72 * @param stdClass|array $row
73 * @see DatabaseLogEntry::getSelectQueryData
74 * @return LogFormatter
76 public static function newFromRow( $row ) {
77 return self
::newFromEntry( DatabaseLogEntry
::newFromRow( $row ) );
82 /** @var LogEntryBase */
85 /** @var int Constant for handling log_deleted */
86 protected $audience = self
::FOR_PUBLIC
;
88 /** @var IContextSource Context for logging */
91 /** @var bool Whether to output user tool links */
92 protected $linkFlood = false;
95 * Set to true if we are constructing a message text that is going to
96 * be included in page history or send to IRC feed. Links are replaced
97 * with plaintext or with [[pagename]] kind of syntax, that is parsed
98 * by page histories and IRC feeds.
101 protected $plaintext = false;
104 protected $irctext = false;
107 * @var LinkRenderer|null
109 private $linkRenderer;
112 * @see LogFormatter::getMessageParameters
115 protected $parsedParameters;
117 protected function __construct( LogEntry
$entry ) {
118 $this->entry
= $entry;
119 $this->context
= RequestContext
::getMain();
123 * Replace the default context
124 * @param IContextSource $context
126 public function setContext( IContextSource
$context ) {
127 $this->context
= $context;
132 * @param LinkRenderer $linkRenderer
134 public function setLinkRenderer( LinkRenderer
$linkRenderer ) {
135 $this->linkRenderer
= $linkRenderer;
140 * @return LinkRenderer
142 public function getLinkRenderer() {
143 if ( $this->linkRenderer
!== null ) {
144 return $this->linkRenderer
;
146 return MediaWikiServices
::getInstance()->getLinkRenderer();
151 * Set the visibility restrictions for displaying content.
152 * If set to public, and an item is deleted, then it will be replaced
153 * with a placeholder even if the context user is allowed to view it.
154 * @param int $audience Const self::FOR_THIS_USER or self::FOR_PUBLIC
156 public function setAudience( $audience ) {
157 $this->audience
= ( $audience == self
::FOR_THIS_USER
)
158 ? self
::FOR_THIS_USER
163 * Check if a log item can be displayed
164 * @param int $field LogPage::DELETED_* constant
167 protected function canView( $field ) {
168 if ( $this->audience
== self
::FOR_THIS_USER
) {
169 return LogEventsList
::userCanBitfield(
170 $this->entry
->getDeleted(), $field, $this->context
->getUser() );
172 return !$this->entry
->isDeleted( $field );
177 * If set to true, will produce user tool links after
178 * the user name. This should be replaced with generic
182 public function setShowUserToolLinks( $value ) {
183 $this->linkFlood
= $value;
187 * Ugly hack to produce plaintext version of the message.
188 * Usually you also want to set extraneous request context
189 * to avoid formatting for any particular user.
190 * @see getActionText()
191 * @return string Plain text
192 * @return-taint tainted
194 public function getPlainActionText() {
195 $this->plaintext
= true;
196 $text = $this->getActionText();
197 $this->plaintext
= false;
203 * Even uglier hack to maintain backwards compatibility with IRC bots
205 * @see getActionText()
206 * @return string Text
208 public function getIRCActionComment() {
209 $actionComment = $this->getIRCActionText();
210 $comment = $this->entry
->getComment();
212 if ( $comment != '' ) {
213 if ( $actionComment == '' ) {
214 $actionComment = $comment;
216 $actionComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
220 return $actionComment;
224 * Even uglier hack to maintain backwards compatibility with IRC bots
226 * @see getActionText()
227 * @return string Text
229 public function getIRCActionText() {
232 $this->plaintext
= true;
233 $this->irctext
= true;
235 $entry = $this->entry
;
236 $parameters = $entry->getParameters();
237 // @see LogPage::actionText()
238 // Text of title the action is aimed at.
239 $target = $entry->getTarget()->getPrefixedText();
241 switch ( $entry->getType() ) {
243 switch ( $entry->getSubtype() ) {
245 $movesource = $parameters['4::target'];
246 $text = wfMessage( '1movedto2' )
247 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
250 $movesource = $parameters['4::target'];
251 $text = wfMessage( '1movedto2_redir' )
252 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
254 case 'move-noredirect':
256 case 'move_redir-noredirect':
262 switch ( $entry->getSubtype() ) {
264 $text = wfMessage( 'deletedarticle' )
265 ->rawParams( $target )->inContentLanguage()->escaped();
268 $text = wfMessage( 'undeletedarticle' )
269 ->rawParams( $target )->inContentLanguage()->escaped();
271 //case 'revision': // Revision deletion
272 //case 'event': // Log deletion
273 // see https://github.com/wikimedia/mediawiki/commit/a9c243b7b5289dad204278dbe7ed571fd914e395
279 // https://github.com/wikimedia/mediawiki/commit/1a05f8faf78675dc85984f27f355b8825b43efff
280 // Create a diff link to the patrolled revision
281 if ( $entry->getSubtype() === 'patrol' ) {
282 $diffLink = htmlspecialchars(
283 wfMessage( 'patrol-log-diff', $parameters['4::curid'] )
284 ->inContentLanguage()->text() );
285 $text = wfMessage( 'patrol-log-line', $diffLink, "[[$target]]", "" )
286 ->inContentLanguage()->text();
293 switch ( $entry->getSubtype() ) {
295 $text = wfMessage( 'protectedarticle' )
296 ->rawParams( $target . ' ' . $parameters['4::description'] )->inContentLanguage()->escaped();
299 $text = wfMessage( 'unprotectedarticle' )
300 ->rawParams( $target )->inContentLanguage()->escaped();
303 $text = wfMessage( 'modifiedarticleprotection' )
304 ->rawParams( $target . ' ' . $parameters['4::description'] )->inContentLanguage()->escaped();
307 $text = wfMessage( 'movedarticleprotection' )
308 ->rawParams( $target, $parameters['4::oldtitle'] )->inContentLanguage()->escaped();
314 switch ( $entry->getSubtype() ) {
317 $text = wfMessage( 'newuserlog-create-entry' )
318 ->inContentLanguage()->escaped();
322 $text = wfMessage( 'newuserlog-create2-entry' )
323 ->rawParams( $target )->inContentLanguage()->escaped();
326 $text = wfMessage( 'newuserlog-autocreate-entry' )
327 ->inContentLanguage()->escaped();
333 switch ( $entry->getSubtype() ) {
335 $text = wfMessage( 'uploadedimage' )
336 ->rawParams( $target )->inContentLanguage()->escaped();
339 $text = wfMessage( 'overwroteimage' )
340 ->rawParams( $target )->inContentLanguage()->escaped();
346 if ( count( $parameters['4::oldgroups'] ) ) {
347 $oldgroups = implode( ', ', $parameters['4::oldgroups'] );
349 $oldgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
351 if ( count( $parameters['5::newgroups'] ) ) {
352 $newgroups = implode( ', ', $parameters['5::newgroups'] );
354 $newgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
356 switch ( $entry->getSubtype() ) {
358 $text = wfMessage( 'rightslogentry' )
359 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
362 $text = wfMessage( 'rightslogentry-autopromote' )
363 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
369 $text = wfMessage( 'pagemerge-logentry' )
370 ->rawParams( $target, $parameters['4::dest'], $parameters['5::mergepoint'] )
371 ->inContentLanguage()->escaped();
375 switch ( $entry->getSubtype() ) {
377 // Keep compatibility with extensions by checking for
378 // new key (5::duration/6::flags) or old key (0/optional 1)
379 if ( $entry->isLegacy() ) {
380 $rawDuration = $parameters[0];
381 $rawFlags = $parameters[1] ??
'';
383 $rawDuration = $parameters['5::duration'];
384 $rawFlags = $parameters['6::flags'];
386 $duration = $wgContLang->translateBlockExpiry(
389 wfTimestamp( TS_UNIX
, $entry->getTimestamp() )
391 $flags = BlockLogFormatter
::formatBlockFlags( $rawFlags, $wgContLang );
392 $text = wfMessage( 'blocklogentry' )
393 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
396 $text = wfMessage( 'unblocklogentry' )
397 ->rawParams( $target )->inContentLanguage()->escaped();
400 $duration = $wgContLang->translateBlockExpiry(
401 $parameters['5::duration'],
403 wfTimestamp( TS_UNIX
, $entry->getTimestamp() )
405 $flags = BlockLogFormatter
::formatBlockFlags( $parameters['6::flags'], $wgContLang );
406 $text = wfMessage( 'reblock-logentry' )
407 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
413 switch ( $entry->getSubtype() ) {
415 $text = wfMessage( 'import-logentry-upload' )
416 ->rawParams( $target )->inContentLanguage()->escaped();
419 $text = wfMessage( 'import-logentry-interwiki' )
420 ->rawParams( $target )->inContentLanguage()->escaped();
424 // case 'suppress' --private log -- aaron (so we know who to blame in a few years :-D)
427 if ( is_null( $text ) ) {
428 $text = $this->getPlainActionText();
431 $this->plaintext
= false;
432 $this->irctext
= false;
438 * Gets the log action, including username.
439 * @return string HTML
440 * phan-taint-check gets very confused by $this->plaintext, so disable.
441 * @return-taint onlysafefor_html
443 public function getActionText() {
444 if ( $this->canView( LogPage
::DELETED_ACTION
) ) {
445 $element = $this->getActionMessage();
446 if ( $element instanceof Message
) {
447 $element = $this->plaintext ?
$element->text() : $element->escaped();
449 if ( $this->entry
->isDeleted( LogPage
::DELETED_ACTION
) ) {
450 $element = $this->styleRestricedElement( $element );
453 $sep = $this->msg( 'word-separator' );
454 $sep = $this->plaintext ?
$sep->text() : $sep->escaped();
455 $performer = $this->getPerformerElement();
456 $element = $performer . $sep . $this->getRestrictedElement( 'rev-deleted-event' );
463 * Returns a sentence describing the log action. Usually
464 * a Message object is returned, but old style log types
465 * and entries might return pre-escaped HTML string.
466 * @return Message|string Pre-escaped HTML
468 protected function getActionMessage() {
469 $message = $this->msg( $this->getMessageKey() );
470 $message->params( $this->getMessageParameters() );
476 * Returns a key to be used for formatting the action sentence.
477 * Default is logentry-TYPE-SUBTYPE for modern logs. Legacy log
478 * types will use custom keys, and subclasses can also alter the
479 * key depending on the entry itself.
480 * @return string Message key
482 protected function getMessageKey() {
483 $type = $this->entry
->getType();
484 $subtype = $this->entry
->getSubtype();
486 return "logentry-$type-$subtype";
490 * Returns extra links that comes after the action text, like "revert", etc.
494 public function getActionLinks() {
499 * Extracts the optional extra parameters for use in action messages.
500 * The array indexes start from number 3.
503 protected function extractParameters() {
504 $entry = $this->entry
;
507 if ( $entry->isLegacy() ) {
508 foreach ( $entry->getParameters() as $index => $value ) {
509 $params[$index +
3] = $value;
513 // Filter out parameters which are not in format #:foo
514 foreach ( $entry->getParameters() as $key => $value ) {
515 if ( strpos( $key, ':' ) === false ) {
518 list( $index, $type, ) = explode( ':', $key, 3 );
519 if ( ctype_digit( $index ) ) {
520 $params[$index - 1] = $this->formatParameterValue( $type, $value );
524 /* Message class doesn't like non consecutive numbering.
525 * Fill in missing indexes with empty strings to avoid
526 * incorrect renumbering.
528 if ( count( $params ) ) {
529 $max = max( array_keys( $params ) );
530 // index 0 to 2 are added in getMessageParameters
531 for ( $i = 3; $i < $max; $i++
) {
532 if ( !isset( $params[$i] ) ) {
542 * Formats parameters intented for action message from
543 * array of all parameters. There are three hardcoded
544 * parameters (array is zero-indexed, this list not):
545 * - 1: user name with premade link
546 * - 2: usable for gender magic function
547 * - 3: target page with premade link
550 protected function getMessageParameters() {
551 if ( isset( $this->parsedParameters
) ) {
552 return $this->parsedParameters
;
555 $entry = $this->entry
;
556 $params = $this->extractParameters();
557 $params[0] = Message
::rawParam( $this->getPerformerElement() );
558 $params[1] = $this->canView( LogPage
::DELETED_USER
) ?
$entry->getPerformer()->getName() : '';
559 $params[2] = Message
::rawParam( $this->makePageLink( $entry->getTarget() ) );
561 // Bad things happens if the numbers are not in correct order
564 $this->parsedParameters
= $params;
565 return $this->parsedParameters
;
569 * Formats parameters values dependent to their type
570 * @param string $type The type of the value.
571 * Valid are currently:
572 * * - (empty) or plain: The value is returned as-is
573 * * raw: The value will be added to the log message
574 * as raw parameter (e.g. no escaping)
575 * Use this only if there is no other working
576 * type like user-link or title-link
577 * * msg: The value is a message-key, the output is
578 * the message in user language
579 * * msg-content: The value is a message-key, the output
580 * is the message in content language
581 * * user: The value is a user name, e.g. for GENDER
582 * * user-link: The value is a user name, returns a
584 * * title: The value is a page title,
585 * returns name of page
586 * * title-link: The value is a page title,
587 * returns link to this page
588 * * number: Format value as number
589 * * list: Format value as a comma-separated list
590 * @param mixed $value The parameter value that should be formatted
591 * @return string|array Formated value
594 protected function formatParameterValue( $type, $value ) {
595 $saveLinkFlood = $this->linkFlood
;
597 switch ( strtolower( trim( $type ) ) ) {
599 $value = Message
::rawParam( $value );
602 $value = $this->context
->getLanguage()->commaList( $value );
605 $value = $this->msg( $value )->text();
608 $value = $this->msg( $value )->inContentLanguage()->text();
611 $value = Message
::numParam( $value );
614 $user = User
::newFromName( $value );
615 $value = $user->getName();
618 $this->setShowUserToolLinks( false );
620 $user = User
::newFromName( $value );
621 $value = Message
::rawParam( $this->makeUserLink( $user ) );
623 $this->setShowUserToolLinks( $saveLinkFlood );
626 $title = Title
::newFromText( $value );
627 $value = $title->getPrefixedText();
630 $title = Title
::newFromText( $value );
631 $value = Message
::rawParam( $this->makePageLink( $title ) );
634 // Plain text, nothing to do
636 // Catch other types and use the old behavior (return as-is)
643 * Helper to make a link to the page, taking the plaintext
644 * value in consideration.
645 * @param Title|null $title The page
646 * @param array $parameters Query parameters
647 * @param string|null $html Linktext of the link as raw html
650 protected function makePageLink( Title
$title = null, $parameters = [], $html = null ) {
651 if ( !$title instanceof Title
) {
652 $msg = $this->msg( 'invalidtitle' )->text();
653 if ( !$this->plaintext
) {
654 return Html
::element( 'span', [ 'class' => 'mw-invalidtitle' ], $msg );
660 if ( !$this->plaintext
) {
661 $html = $html !== null ?
new HtmlArmor( $html ) : $html;
662 $link = $this->getLinkRenderer()->makeLink( $title, $html, [], $parameters );
664 $link = '[[' . $title->getPrefixedText() . ']]';
671 * Provides the name of the user who performed the log action.
672 * Used as part of log action message or standalone, depending
673 * which parts of the log entry has been hidden.
676 public function getPerformerElement() {
677 if ( $this->canView( LogPage
::DELETED_USER
) ) {
678 $performer = $this->entry
->getPerformer();
679 $element = $this->makeUserLink( $performer );
680 if ( $this->entry
->isDeleted( LogPage
::DELETED_USER
) ) {
681 $element = $this->styleRestricedElement( $element );
684 $element = $this->getRestrictedElement( 'rev-deleted-user' );
691 * Gets the user provided comment
692 * @return string HTML
694 public function getComment() {
695 if ( $this->canView( LogPage
::DELETED_COMMENT
) ) {
696 $comment = Linker
::commentBlock( $this->entry
->getComment() );
697 // No hard coded spaces thanx
698 $element = ltrim( $comment );
699 if ( $this->entry
->isDeleted( LogPage
::DELETED_COMMENT
) ) {
700 $element = $this->styleRestricedElement( $element );
703 $element = $this->getRestrictedElement( 'rev-deleted-comment' );
710 * Helper method for displaying restricted element.
711 * @param string $message
712 * @return string HTML or wiki text
713 * @return-taint onlysafefor_html
715 protected function getRestrictedElement( $message ) {
716 if ( $this->plaintext
) {
717 return $this->msg( $message )->text();
720 $content = $this->msg( $message )->escaped();
721 $attribs = [ 'class' => 'history-deleted' ];
723 return Html
::rawElement( 'span', $attribs, $content );
727 * Helper method for styling restricted element.
728 * @param string $content
729 * @return string HTML or wiki text
731 protected function styleRestricedElement( $content ) {
732 if ( $this->plaintext
) {
735 $attribs = [ 'class' => 'history-deleted' ];
737 return Html
::rawElement( 'span', $attribs, $content );
741 * Shortcut for wfMessage which honors local context.
745 protected function msg( $key ) {
746 return $this->context
->msg( $key );
751 * @param int $toolFlags Combination of Linker::TOOL_LINKS_* flags
752 * @return string wikitext or html
753 * @return-taint onlysafefor_html
755 protected function makeUserLink( User
$user, $toolFlags = 0 ) {
756 if ( $this->plaintext
) {
757 $element = $user->getName();
759 $element = Linker
::userLink(
764 if ( $this->linkFlood
) {
765 $element .= Linker
::userToolLinks(
768 true, // redContribsWhenNoEdits
770 $user->getEditCount()
779 * @return array Array of titles that should be preloaded with LinkBatch
781 public function getPreloadTitles() {
786 * @return array Output of getMessageParameters() for testing
788 public function getMessageParametersForTesting() {
789 // This function was added because getMessageParameters() is
790 // protected and a change from protected to public caused
791 // problems with extensions
792 return $this->getMessageParameters();
796 * Get the array of parameters, converted from legacy format if necessary.
800 protected function getParametersForApi() {
801 return $this->entry
->getParameters();
805 * Format parameters for API output
807 * The result array should generally map named keys to values. Index and
808 * type should be omitted, e.g. "4::foo" should be returned as "foo" in the
809 * output. Values should generally be unformatted.
811 * Renames or removals of keys besides from the legacy numeric format to
812 * modern named style should be avoided. Any renames should be announced to
813 * the mediawiki-api-announce mailing list.
818 public function formatParametersForApi() {
820 foreach ( $this->getParametersForApi() as $key => $value ) {
821 $vals = explode( ':', $key, 3 );
822 if ( count( $vals ) !== 3 ) {
823 $logParams[$key] = $value;
826 $logParams +
= $this->formatParameterValueForApi( $vals[2], $vals[1], $value );
828 ApiResult
::setIndexedTagName( $logParams, 'param' );
829 ApiResult
::setArrayType( $logParams, 'assoc' );
835 * Format a single parameter value for API output
838 * @param string $name
839 * @param string $type
840 * @param string $value
843 protected function formatParameterValueForApi( $name, $type, $value ) {
844 $type = strtolower( trim( $type ) );
847 $value = (bool)$value;
851 if ( ctype_digit( $value ) ||
is_int( $value ) ) {
852 $value = (int)$value;
854 $value = (float)$value;
861 if ( is_array( $value ) ) {
862 ApiResult
::setArrayType( $value, $type );
867 $value = wfTimestamp( TS_ISO_8601
, $value );
872 $msg = $this->msg( $value );
873 if ( $type === 'msg-content' ) {
874 $msg->inContentLanguage();
877 $value["{$name}_key"] = $msg->getKey();
878 if ( $msg->getParams() ) {
879 $value["{$name}_params"] = $msg->getParams();
881 $value["{$name}_text"] = $msg->text();
886 $title = Title
::newFromText( $value );
888 // Huh? Do something halfway sane.
889 $title = SpecialPage
::getTitleFor( 'Badtitle', $value );
892 ApiQueryBase
::addTitleInfo( $value, $title, "{$name}_" );
897 $user = User
::newFromName( $value );
899 $value = $user->getName();
908 return [ $name => $value ];
913 * This class formats all log entries for log types
914 * which have not been converted to the new system.
915 * This is not about old log entries which store
916 * parameters in a different format - the new
917 * LogFormatter classes have code to support formatting
921 class LegacyLogFormatter
extends LogFormatter
{
923 * Backward compatibility for extension changing the comment from
924 * the LogLine hook. This will be set by the first call on getComment(),
925 * then it might be modified by the hook when calling getActionLinks(),
926 * so that the modified value will be returned when calling getComment()
931 private $comment = null;
934 * Cache for the result of getActionLinks() so that it does not need to
935 * run multiple times depending on the order that getComment() and
936 * getActionLinks() are called.
940 private $revert = null;
942 public function getComment() {
943 if ( $this->comment
=== null ) {
944 $this->comment
= parent
::getComment();
947 // Make sure we execute the LogLine hook so that we immediately return
948 // the correct value.
949 if ( $this->revert
=== null ) {
950 $this->getActionLinks();
953 return $this->comment
;
958 * @return-taint onlysafefor_html
960 protected function getActionMessage() {
961 $entry = $this->entry
;
962 $action = LogPage
::actionText(
964 $entry->getSubtype(),
966 $this->plaintext ?
null : $this->context
->getSkin(),
967 (array)$entry->getParameters(),
968 !$this->plaintext
// whether to filter [[]] links
971 $performer = $this->getPerformerElement();
972 if ( !$this->irctext
) {
973 $sep = $this->msg( 'word-separator' );
974 $sep = $this->plaintext ?
$sep->text() : $sep->escaped();
975 $action = $performer . $sep . $action;
981 public function getActionLinks() {
982 if ( $this->revert
!== null ) {
983 return $this->revert
;
986 if ( $this->entry
->isDeleted( LogPage
::DELETED_ACTION
) ) {
988 return $this->revert
;
991 $title = $this->entry
->getTarget();
992 $type = $this->entry
->getType();
993 $subtype = $this->entry
->getSubtype();
995 // Do nothing. The implementation is handled by the hook modifiying the
996 // passed-by-ref parameters. This also changes the default value so that
997 // getComment() and getActionLinks() do not call them indefinitely.
1000 // This is to populate the $comment member of this instance so that it
1001 // can be modified when calling the hook just below.
1002 if ( $this->comment
=== null ) {
1003 $this->getComment();
1006 $params = $this->entry
->getParameters();
1008 Hooks
::run( 'LogLine', [ $type, $subtype, $title, $params,
1009 &$this->comment
, &$this->revert
, $this->entry
->getTimestamp() ] );
1011 return $this->revert
;