MediaWiki master
LogFormatter.php
Go to the documentation of this file.
1<?php
26namespace MediaWiki\Logging;
27
46use stdClass;
50
64 // Audience options for viewing usernames, comments, and actions
65 public const FOR_PUBLIC = 1;
66 public const FOR_THIS_USER = 2;
67
68 // Static->
69
76 public static function newFromEntry( LogEntry $entry ) {
77 wfDeprecated( __METHOD__, '1.42' );
78 return MediaWikiServices::getInstance()->getLogFormatterFactory()->newFromEntry( $entry );
79 }
80
89 public static function newFromRow( $row ) {
90 wfDeprecated( __METHOD__, '1.42' );
92 }
93
94 // Nonstatic->
95
97 protected $entry;
98
101
103 public $context;
104
106 protected $linkFlood = false;
107
115 protected $plaintext = false;
116
118 protected $irctext = false;
119
121 private $linkRenderer;
122
124 private $contentLanguage;
125
127 private $commentFormatter;
128
130 private $userEditTracker;
131
137
143 public function __construct( LogEntry $entry ) {
144 $this->entry = $entry;
145 $this->context = RequestContext::getMain();
146 }
147
151 public function setContext( IContextSource $context ) {
152 $this->context = $context;
153 }
154
159 public function setLinkRenderer( LinkRenderer $linkRenderer ) {
160 $this->linkRenderer = $linkRenderer;
161 }
162
167 public function getLinkRenderer() {
168 if ( $this->linkRenderer !== null ) {
169 return $this->linkRenderer;
170 } else {
171 wfDeprecated( static::class . " without all required services", '1.42' );
172 return MediaWikiServices::getInstance()->getLinkRenderer();
173 }
174 }
175
181 final public function setContentLanguage( Language $contentLanguage ) {
182 $this->contentLanguage = $contentLanguage;
183 }
184
189 final public function getContentLanguage(): Language {
190 if ( $this->contentLanguage === null ) {
191 wfDeprecated( static::class . " without all required services", '1.42' );
192 $this->contentLanguage = MediaWikiServices::getInstance()->getContentLanguage();
193 }
194 return $this->contentLanguage;
195 }
196
202 final public function setCommentFormatter( CommentFormatter $commentFormatter ) {
203 $this->commentFormatter = $commentFormatter;
204 }
205
210 final public function getCommentFormatter(): CommentFormatter {
211 if ( $this->commentFormatter === null ) {
212 wfDeprecated( static::class . " without all required services", '1.42' );
213 $this->commentFormatter = MediaWikiServices::getInstance()->getCommentFormatter();
214 }
215 return $this->commentFormatter;
216 }
217
223 final public function setUserEditTracker( UserEditTracker $userEditTracker ) {
224 $this->userEditTracker = $userEditTracker;
225 }
226
231 final public function getUserEditTracker(): UserEditTracker {
232 if ( $this->userEditTracker === null ) {
233 wfDeprecated( static::class . " without all required services", '1.42' );
234 $this->userEditTracker = MediaWikiServices::getInstance()->getUserEditTracker();
235 }
236 return $this->userEditTracker;
237 }
238
245 public function setAudience( $audience ) {
246 $this->audience = ( $audience == self::FOR_THIS_USER )
247 ? self::FOR_THIS_USER
248 : self::FOR_PUBLIC;
249 }
250
255 public function canViewLogType() {
256 // If the user doesn't have the right permission to view the specific
257 // log type, return false
258 $logRestrictions = $this->context->getConfig()->get( MainConfigNames::LogRestrictions );
259 $type = $this->entry->getType();
260 return !isset( $logRestrictions[$type] )
261 || $this->context->getAuthority()->isAllowed( $logRestrictions[$type] );
262 }
263
269 protected function canView( $field ) {
270 if ( $this->audience == self::FOR_THIS_USER ) {
271 return LogEventsList::userCanBitfield(
272 $this->entry->getDeleted(), $field, $this->context->getAuthority() ) &&
273 self::canViewLogType();
274 } else {
275 return !$this->entry->isDeleted( $field ) && self::canViewLogType();
276 }
277 }
278
285 public function setShowUserToolLinks( $value ) {
286 $this->linkFlood = $value;
287 }
288
297 public function getPlainActionText() {
298 $this->plaintext = true;
299 $text = $this->getActionText();
300 $this->plaintext = false;
301
302 return $text;
303 }
304
311 public function getIRCActionComment() {
312 $actionComment = $this->getIRCActionText();
313 $comment = $this->entry->getComment();
314
315 if ( $comment != '' ) {
316 if ( $actionComment == '' ) {
317 $actionComment = $comment;
318 } else {
319 $actionComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
320 }
321 }
322
323 return $actionComment;
324 }
325
333 public function getIRCActionText() {
334 $this->plaintext = true;
335 $this->irctext = true;
336
337 $entry = $this->entry;
338 $parameters = $entry->getParameters();
339 // @see LogPage::actionText()
340 // Text of title the action is aimed at.
341 $target = $entry->getTarget()->getPrefixedText();
342 $text = null;
343 $contLang = $this->getContentLanguage();
344 switch ( $entry->getType() ) {
345 case 'move':
346 switch ( $entry->getSubtype() ) {
347 case 'move':
348 $movesource = $parameters['4::target'];
349 $text = wfMessage( '1movedto2' )
350 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
351 break;
352 case 'move_redir':
353 $movesource = $parameters['4::target'];
354 $text = wfMessage( '1movedto2_redir' )
355 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
356 break;
357 case 'move-noredirect':
358 break;
359 case 'move_redir-noredirect':
360 break;
361 }
362 break;
363
364 case 'delete':
365 switch ( $entry->getSubtype() ) {
366 case 'delete':
367 $text = wfMessage( 'deletedarticle' )
368 ->rawParams( $target )->inContentLanguage()->escaped();
369 break;
370 case 'restore':
371 $text = wfMessage( 'undeletedarticle' )
372 ->rawParams( $target )->inContentLanguage()->escaped();
373 break;
374 }
375 break;
376
377 case 'patrol':
378 // https://github.com/wikimedia/mediawiki/commit/1a05f8faf78675dc85984f27f355b8825b43efff
379 // Create a diff link to the patrolled revision
380 if ( $entry->getSubtype() === 'patrol' ) {
381 $diffLink = htmlspecialchars(
382 wfMessage( 'patrol-log-diff', $parameters['4::curid'] )
383 ->inContentLanguage()->text() );
384 $text = wfMessage( 'patrol-log-line', $diffLink, "[[$target]]", "" )
385 ->inContentLanguage()->text();
386 } else {
387 // broken??
388 }
389 break;
390
391 case 'protect':
392 switch ( $entry->getSubtype() ) {
393 case 'protect':
394 $text = wfMessage( 'protectedarticle' )
395 ->rawParams( $target . ' ' . $parameters['4::description'] )
396 ->inContentLanguage()
397 ->escaped();
398 break;
399 case 'unprotect':
400 $text = wfMessage( 'unprotectedarticle' )
401 ->rawParams( $target )->inContentLanguage()->escaped();
402 break;
403 case 'modify':
404 $text = wfMessage( 'modifiedarticleprotection' )
405 ->rawParams( $target . ' ' . $parameters['4::description'] )
406 ->inContentLanguage()
407 ->escaped();
408 break;
409 case 'move_prot':
410 $text = wfMessage( 'movedarticleprotection' )
411 ->rawParams( $target, $parameters['4::oldtitle'] )->inContentLanguage()->escaped();
412 break;
413 }
414 break;
415
416 case 'newusers':
417 switch ( $entry->getSubtype() ) {
418 case 'newusers':
419 case 'create':
420 $text = wfMessage( 'newuserlog-create-entry' )
421 ->inContentLanguage()->escaped();
422 break;
423 case 'create2':
424 case 'byemail':
425 $text = wfMessage( 'newuserlog-create2-entry' )
426 ->rawParams( $target )->inContentLanguage()->escaped();
427 break;
428 case 'autocreate':
429 $text = wfMessage( 'newuserlog-autocreate-entry' )
430 ->inContentLanguage()->escaped();
431 break;
432 }
433 break;
434
435 case 'upload':
436 switch ( $entry->getSubtype() ) {
437 case 'upload':
438 $text = wfMessage( 'uploadedimage' )
439 ->rawParams( $target )->inContentLanguage()->escaped();
440 break;
441 case 'overwrite':
442 case 'revert':
443 $text = wfMessage( 'overwroteimage' )
444 ->rawParams( $target )->inContentLanguage()->escaped();
445 break;
446 }
447 break;
448
449 case 'rights':
450 if ( count( $parameters['4::oldgroups'] ) ) {
451 $oldgroups = implode( ', ', $parameters['4::oldgroups'] );
452 } else {
453 $oldgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
454 }
455 if ( count( $parameters['5::newgroups'] ) ) {
456 $newgroups = implode( ', ', $parameters['5::newgroups'] );
457 } else {
458 $newgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
459 }
460 switch ( $entry->getSubtype() ) {
461 case 'rights':
462 $text = wfMessage( 'rightslogentry' )
463 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
464 break;
465 case 'autopromote':
466 $text = wfMessage( 'rightslogentry-autopromote' )
467 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
468 break;
469 }
470 break;
471
472 case 'merge':
473 switch ( $entry->getSubtype() ) {
474 case 'merge':
475 $text = wfMessage( 'pagemerge-logentry' )
476 ->rawParams( $target, $parameters['4::dest'], $parameters['5::mergepoint'] )
477 ->inContentLanguage()->escaped();
478 break;
479
480 case 'merge-into':
481 // Nothing for IRC (already covered by the log at the source page)
482 return '';
483 }
484 break;
485
486 case 'block':
487 switch ( $entry->getSubtype() ) {
488 case 'block':
489 // Keep compatibility with extensions by checking for
490 // new key (5::duration/6::flags) or old key (0/optional 1)
491 if ( $entry->isLegacy() ) {
492 $rawDuration = $parameters[0];
493 $rawFlags = $parameters[1] ?? '';
494 } else {
495 $rawDuration = $parameters['5::duration'];
496 $rawFlags = $parameters['6::flags'];
497 }
498 $duration = $contLang->translateBlockExpiry(
499 $rawDuration,
500 null,
501 (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
502 );
503 $flags = BlockLogFormatter::formatBlockFlags( $rawFlags, $contLang );
504 $text = wfMessage( 'blocklogentry' )
505 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
506 break;
507 case 'unblock':
508 $text = wfMessage( 'unblocklogentry' )
509 ->rawParams( $target )->inContentLanguage()->escaped();
510 break;
511 case 'reblock':
512 $duration = $contLang->translateBlockExpiry(
513 $parameters['5::duration'],
514 null,
515 (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
516 );
517 $flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'],
518 $contLang );
519 $text = wfMessage( 'reblock-logentry' )
520 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
521 break;
522 }
523 break;
524
525 case 'import':
526 switch ( $entry->getSubtype() ) {
527 case 'upload':
528 $text = wfMessage( 'import-logentry-upload' )
529 ->rawParams( $target )->inContentLanguage()->escaped();
530 break;
531 case 'interwiki':
532 $text = wfMessage( 'import-logentry-interwiki' )
533 ->rawParams( $target )->inContentLanguage()->escaped();
534 break;
535 }
536 break;
537 // case 'suppress' --private log -- aaron (so we know who to blame in a few years :-D)
538 // default:
539 }
540
541 $this->plaintext = false;
542 $this->irctext = false;
543
544 return $text ?? $this->getPlainActionText();
545 }
546
554 public function getActionText() {
555 if ( $this->canView( LogPage::DELETED_ACTION ) ) {
556 $element = $this->getActionMessage();
557 if ( $element instanceof Message ) {
558 $element = $this->plaintext ? $element->text() : $element->escaped();
559 }
560 if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
561 $element = $this->styleRestrictedElement( $element );
562 }
563 } else {
564 $sep = $this->msg( 'word-separator' );
565 $sep = $this->plaintext ? $sep->text() : $sep->escaped();
566 $performer = $this->getPerformerElement();
567 $element = $performer . $sep . $this->getRestrictedElement( 'rev-deleted-event' );
568 }
569
570 return $element;
571 }
572
579 protected function getActionMessage() {
580 $message = $this->msg( $this->getMessageKey() );
581 $message->params( $this->getMessageParameters() );
582
583 return $message;
584 }
585
594 protected function getMessageKey() {
595 $type = $this->entry->getType();
596 $subtype = $this->entry->getSubtype();
597
598 return "logentry-$type-$subtype";
599 }
600
607 public function getActionLinks() {
608 return '';
609 }
610
617 protected function extractParameters() {
618 $entry = $this->entry;
619 $params = [];
620
621 if ( $entry->isLegacy() ) {
622 foreach ( $entry->getParameters() as $index => $value ) {
623 $params[$index + 3] = $value;
624 }
625 }
626
627 // Filter out parameters which are not in format #:foo
628 foreach ( $entry->getParameters() as $key => $value ) {
629 if ( strpos( $key, ':' ) === false ) {
630 continue;
631 }
632 [ $index, $type, ] = explode( ':', $key, 3 );
633 if ( ctype_digit( $index ) ) {
634 $params[(int)$index - 1] = $this->formatParameterValue( $type, $value );
635 }
636 }
637
638 /* Message class doesn't like non consecutive numbering.
639 * Fill in missing indexes with empty strings to avoid
640 * incorrect renumbering.
641 */
642 if ( count( $params ) ) {
643 $max = max( array_keys( $params ) );
644 // index 0 to 2 are added in getMessageParameters
645 for ( $i = 3; $i < $max; $i++ ) {
646 if ( !isset( $params[$i] ) ) {
647 $params[$i] = '';
648 }
649 }
650 }
651
652 return $params;
653 }
654
672 protected function getMessageParameters() {
673 if ( $this->parsedParameters !== null ) {
674 return $this->parsedParameters;
675 }
676
677 $entry = $this->entry;
678 $params = $this->extractParameters();
679 $params[0] = Message::rawParam( $this->getPerformerElement() );
680 $params[1] = $this->canView( LogPage::DELETED_USER ) ? $entry->getPerformerIdentity()->getName() : '';
681 $params[2] = Message::rawParam( $this->makePageLink( $entry->getTarget() ) );
682
683 // Bad things happens if the numbers are not in correct order
684 ksort( $params );
685
686 $this->parsedParameters = $params;
687 return $this->parsedParameters;
688 }
689
716 protected function formatParameterValue( $type, $value ) {
717 $saveLinkFlood = $this->linkFlood;
718
719 switch ( strtolower( trim( $type ) ) ) {
720 case 'raw':
721 $value = Message::rawParam( $value );
722 break;
723 case 'list':
724 $value = $this->context->getLanguage()->commaList( $value );
725 break;
726 case 'msg':
727 $value = $this->msg( $value )->text();
728 break;
729 case 'msg-content':
730 $value = $this->msg( $value )->inContentLanguage()->text();
731 break;
732 case 'number':
733 $value = Message::numParam( $value );
734 break;
735 case 'user':
736 $user = User::newFromName( $value );
737 $value = $user->getName();
738 break;
739 case 'user-link':
740 $this->setShowUserToolLinks( false );
741
742 $user = User::newFromName( $value );
743
744 if ( !$user ) {
745 $value = $this->msg( 'empty-username' )->text();
746 } else {
747 $value = Message::rawParam( $this->makeUserLink( $user ) );
748 $this->setShowUserToolLinks( $saveLinkFlood );
749 }
750 break;
751 case 'title':
752 $title = Title::newFromText( $value );
753 $value = $title->getPrefixedText();
754 break;
755 case 'title-link':
756 $title = Title::newFromText( $value );
757 $value = Message::rawParam( $this->makePageLink( $title ) );
758 break;
759 case 'plain':
760 // Plain text, nothing to do
761 default:
762 // Catch other types and use the old behavior (return as-is)
763 }
764
765 return $value;
766 }
767
778 protected function makePageLink( ?Title $title = null, $parameters = [], $html = null ) {
779 if ( !$title instanceof Title ) {
780 $msg = $this->msg( 'invalidtitle' )->text();
781 if ( $this->plaintext ) {
782 return $msg;
783 } else {
784 return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ], $msg );
785 }
786 }
787
788 if ( $this->plaintext ) {
789 $link = '[[' . $title->getPrefixedText() . ']]';
790 } else {
791 $html = $html !== null ? new HtmlArmor( $html ) : $html;
792 $link = $this->getLinkRenderer()->makeLink( $title, $html, [], $parameters );
793 }
794
795 return $link;
796 }
797
804 public function getPerformerElement() {
805 if ( $this->canView( LogPage::DELETED_USER ) ) {
806 $performerIdentity = $this->entry->getPerformerIdentity();
807 $element = $this->makeUserLink( $performerIdentity );
808 if ( $this->entry->isDeleted( LogPage::DELETED_USER ) ) {
809 $element = $this->styleRestrictedElement( $element );
810 }
811 } else {
812 $element = $this->getRestrictedElement( 'rev-deleted-user' );
813 }
814
815 return $element;
816 }
817
823 public function getComment() {
824 if ( $this->canView( LogPage::DELETED_COMMENT ) ) {
825 $comment = $this->getCommentFormatter()
826 ->formatBlock( $this->entry->getComment() );
827 // No hard coded spaces thanx
828 $element = ltrim( $comment );
829 if ( $this->entry->isDeleted( LogPage::DELETED_COMMENT ) ) {
830 $element = $this->styleRestrictedElement( $element );
831 }
832 } else {
833 $element = $this->getRestrictedElement( 'rev-deleted-comment' );
834 }
835
836 return $element;
837 }
838
845 protected function getRestrictedElement( $message ) {
846 if ( $this->plaintext ) {
847 return $this->msg( $message )->text();
848 }
849
850 return $this->styleRestrictedElement( $this->msg( $message )->escaped() );
851 }
852
858 protected function styleRestrictedElement( $content ) {
859 if ( $this->plaintext ) {
860 return $content;
861 }
862 $attribs = [ 'class' => [ 'history-deleted' ] ];
863 if ( $this->entry->isDeleted( LogPage::DELETED_RESTRICTED ) ) {
864 $attribs['class'][] = 'mw-history-suppressed';
865 }
866
867 return Html::rawElement( 'span', $attribs, $content );
868 }
869
878 protected function msg( $key, ...$params ) {
879 return $this->context->msg( $key, ...$params );
880 }
881
888 protected function makeUserLink( UserIdentity $user, $toolFlags = 0 ) {
889 if ( $this->plaintext ) {
890 $element = $user->getName();
891 } else {
892 $element = Linker::userLink(
893 $user->getId(),
894 $user->getName()
895 );
896 if ( $this->linkFlood ) {
897 $editCount = $this->getUserEditTracker()->getUserEditCount( $user );
898
899 $element .= Linker::userToolLinks(
900 $user->getId(),
901 $user->getName(),
902 true, // redContribsWhenNoEdits
903 $toolFlags,
904 $editCount,
905 // do not render parentheses in the HTML markup (CSS will provide)
906 false
907 );
908 }
909 }
910
911 return $element;
912 }
913
918 public function getPreloadTitles() {
919 return [];
920 }
921
926 // This function was added because getMessageParameters() is
927 // protected and a change from protected to public caused
928 // problems with extensions
929 return $this->getMessageParameters();
930 }
931
938 protected function getParametersForApi() {
939 return $this->entry->getParameters();
940 }
941
957 public function formatParametersForApi() {
958 $logParams = [];
959 foreach ( $this->getParametersForApi() as $key => $value ) {
960 $vals = explode( ':', $key, 3 );
961 if ( count( $vals ) !== 3 ) {
962 if ( $value instanceof \__PHP_Incomplete_Class ) {
963 wfLogWarning( 'Log entry of type ' . $this->entry->getFullType() .
964 ' contains unrecoverable extra parameters.' );
965 continue;
966 }
967 $logParams[$key] = $value;
968 continue;
969 }
970 $logParams += $this->formatParameterValueForApi( $vals[2], $vals[1], $value );
971 }
972 ApiResult::setIndexedTagName( $logParams, 'param' );
973 ApiResult::setArrayType( $logParams, 'assoc' );
974
975 return $logParams;
976 }
977
987 protected function formatParameterValueForApi( $name, $type, $value ) {
988 $type = strtolower( trim( $type ) );
989 switch ( $type ) {
990 case 'bool':
991 $value = (bool)$value;
992 break;
993
994 case 'number':
995 if ( is_int( $value ) || ctype_digit( (string)$value ) ) {
996 $value = (int)$value;
997 } else {
998 $value = (float)$value;
999 }
1000 break;
1001
1002 case 'array':
1003 case 'assoc':
1004 case 'kvp':
1005 if ( is_array( $value ) ) {
1006 ApiResult::setArrayType( $value, $type );
1007 }
1008 break;
1009
1010 case 'timestamp':
1011 $value = wfTimestamp( TS_ISO_8601, $value );
1012 break;
1013
1014 case 'msg':
1015 case 'msg-content':
1016 $msg = $this->msg( $value );
1017 if ( $type === 'msg-content' ) {
1018 $msg->inContentLanguage();
1019 }
1020 $value = [];
1021 $value["{$name}_key"] = $msg->getKey();
1022 if ( $msg->getParams() ) {
1023 $value["{$name}_params"] = $msg->getParams();
1024 }
1025 $value["{$name}_text"] = $msg->text();
1026 return $value;
1027
1028 case 'title':
1029 case 'title-link':
1030 $title = Title::newFromText( $value );
1031 if ( !$title ) {
1032 $title = SpecialPage::getTitleFor( 'Badtitle', $value );
1033 }
1034 $value = [];
1035 ApiQueryBase::addTitleInfo( $value, $title, "{$name}_" );
1036 return $value;
1037
1038 case 'user':
1039 case 'user-link':
1040 $user = User::newFromName( $value );
1041 if ( $user ) {
1042 $value = $user->getName();
1043 }
1044 break;
1045
1046 default:
1047 // do nothing
1048 break;
1049 }
1050
1051 return [ $name => $value ];
1052 }
1053}
1054
1056class_alias( LogFormatter::class, 'LogFormatter' );
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:82
This is a base class for all Query modules.
This class represents the result of the API operations.
Definition ApiResult.php:45
This is the main service interface for converting single-line comments from various DB comment fields...
Group all the pieces relevant to the context of a request into one instance.
This class is a collection of static functions that serve two purposes:
Definition Html.php:57
Base class for language-specific code.
Definition Language.php:81
Class that generates HTML for internal links.
Some internal bits split of from Skin.php.
Definition Linker.php:61
static newFromRow( $row)
Constructs new LogEntry from database result row.
Extends the LogEntry Interface with some basic functionality.
Implements the default log formatting.
setContext(IContextSource $context)
Replace the default context.
setShowUserToolLinks( $value)
If set to true, will produce user tool links after the user name.
canView( $field)
Check if a log item can be displayed.
styleRestrictedElement( $content)
Helper method for styling restricted element.
setLinkRenderer(LinkRenderer $linkRenderer)
makeUserLink(UserIdentity $user, $toolFlags=0)
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
makePageLink(?Title $title=null, $parameters=[], $html=null)
Helper to make a link to the page, taking the plaintext value in consideration.
static newFromRow( $row)
Handy shortcut for constructing a formatter directly from database row.
extractParameters()
Extracts the optional extra parameters for use in action messages.
bool $linkFlood
Whether to output user tool links.
getActionText()
Gets the log action, including username.
setContentLanguage(Language $contentLanguage)
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.
setCommentFormatter(CommentFormatter $commentFormatter)
getMessageParameters()
Formats parameters intended for action message from array of all parameters.
setAudience( $audience)
Set the visibility restrictions for displaying content.
bool $plaintext
Set to true if we are constructing a message text that is going to be included in page history or sen...
canViewLogType()
Check if a log item type can be displayed.
getIRCActionText()
Even uglier hack to maintain backwards compatibility with IRC bots (T36508).
getParametersForApi()
Get the array of parameters, converted from legacy format if necessary.
getMessageKey()
Returns a key to be used for formatting the action sentence.
getIRCActionComment()
Even uglier hack to maintain backwards compatibility with IRC bots (T36508).
setUserEditTracker(UserEditTracker $userEditTracker)
getActionMessage()
Returns a sentence describing the log action.
getRestrictedElement( $message)
Helper method for displaying restricted element.
getPerformerElement()
Provides the name of the user who performed the log action.
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
formatParameterValueForApi( $name, $type, $value)
Format a single parameter value for API output.
formatParametersForApi()
Format parameters for API output.
int $audience
Constant for handling log_deleted.
formatParameterValue( $type, $value)
Formats parameters values dependent to their type.
getComment()
Gets the user provided comment.
getPlainActionText()
Ugly hack to produce plaintext version of the message.
IContextSource $context
Context for logging.
A class containing constants representing the names of configuration variables.
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:157
Parent class for all special pages.
Represents a title within MediaWiki.
Definition Title.php:78
Track info about user edit counts and timings.
User class for the MediaWiki software.
Definition User.php:123
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:32
Value object representing a message parameter that consists of a list of values.
Interface for objects which can provide a MediaWiki context on request.
Represents the target of a wiki link.
An individual log entry.
Definition LogEntry.php:37
Interface for objects representing user identity.
getId( $wikiId=self::LOCAL)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...