MediaWiki master
LogFormatter.php
Go to the documentation of this file.
1<?php
12namespace MediaWiki\Logging;
13
32use stdClass;
36
50 // Audience options for viewing usernames, comments, and actions
51 public const FOR_PUBLIC = 1;
52 public const FOR_THIS_USER = 2;
53
54 // Static->
55
62 public static function newFromEntry( LogEntry $entry ) {
63 wfDeprecated( __METHOD__, '1.42' );
64 return MediaWikiServices::getInstance()->getLogFormatterFactory()->newFromEntry( $entry );
65 }
66
75 public static function newFromRow( $row ) {
76 wfDeprecated( __METHOD__, '1.42' );
78 }
79
80 // Nonstatic->
81
83 protected $entry;
84
87
89 public $context;
90
92 protected $linkFlood = false;
93
101 protected $plaintext = false;
102
104 protected $irctext = false;
105
107 private $linkRenderer;
108
110 private $contentLanguage;
111
113 private $commentFormatter;
114
116 private $userEditTracker;
117
123
129 public function __construct( LogEntry $entry ) {
130 $this->entry = $entry;
131 $this->context = RequestContext::getMain();
132 }
133
137 public function setContext( IContextSource $context ) {
138 $this->context = $context;
139 }
140
145 public function setLinkRenderer( LinkRenderer $linkRenderer ) {
146 $this->linkRenderer = $linkRenderer;
147 }
148
153 public function getLinkRenderer() {
154 if ( $this->linkRenderer !== null ) {
155 return $this->linkRenderer;
156 } else {
157 wfDeprecated( static::class . " without all required services", '1.42' );
158 return MediaWikiServices::getInstance()->getLinkRenderer();
159 }
160 }
161
167 final public function setContentLanguage( Language $contentLanguage ) {
168 $this->contentLanguage = $contentLanguage;
169 }
170
175 final public function getContentLanguage(): Language {
176 if ( $this->contentLanguage === null ) {
177 wfDeprecated( static::class . " without all required services", '1.42' );
178 $this->contentLanguage = MediaWikiServices::getInstance()->getContentLanguage();
179 }
180 return $this->contentLanguage;
181 }
182
188 final public function setCommentFormatter( CommentFormatter $commentFormatter ) {
189 $this->commentFormatter = $commentFormatter;
190 }
191
196 final public function getCommentFormatter(): CommentFormatter {
197 if ( $this->commentFormatter === null ) {
198 wfDeprecated( static::class . " without all required services", '1.42' );
199 $this->commentFormatter = MediaWikiServices::getInstance()->getCommentFormatter();
200 }
201 return $this->commentFormatter;
202 }
203
209 final public function setUserEditTracker( UserEditTracker $userEditTracker ) {
210 $this->userEditTracker = $userEditTracker;
211 }
212
217 final public function getUserEditTracker(): UserEditTracker {
218 if ( $this->userEditTracker === null ) {
219 wfDeprecated( static::class . " without all required services", '1.42' );
220 $this->userEditTracker = MediaWikiServices::getInstance()->getUserEditTracker();
221 }
222 return $this->userEditTracker;
223 }
224
231 public function setAudience( $audience ) {
232 $this->audience = ( $audience == self::FOR_THIS_USER )
233 ? self::FOR_THIS_USER
234 : self::FOR_PUBLIC;
235 }
236
241 public function canViewLogType() {
242 // If the user doesn't have the right permission to view the specific
243 // log type, return false
244 $logRestrictions = $this->context->getConfig()->get( MainConfigNames::LogRestrictions );
245 $type = $this->entry->getType();
246 return !isset( $logRestrictions[$type] )
247 || $this->context->getAuthority()->isAllowed( $logRestrictions[$type] );
248 }
249
255 protected function canView( $field ) {
256 if ( $this->audience == self::FOR_THIS_USER ) {
257 return LogEventsList::userCanBitfield(
258 $this->entry->getDeleted(), $field, $this->context->getAuthority() ) &&
259 self::canViewLogType();
260 } else {
261 return !$this->entry->isDeleted( $field ) && self::canViewLogType();
262 }
263 }
264
271 public function setShowUserToolLinks( $value ) {
272 $this->linkFlood = $value;
273 }
274
283 public function getPlainActionText() {
284 $this->plaintext = true;
285 $text = $this->getActionText();
286 $this->plaintext = false;
287
288 return $text;
289 }
290
297 public function getIRCActionComment() {
298 $actionComment = $this->getIRCActionText();
299 $comment = $this->entry->getComment();
300
301 if ( $comment != '' ) {
302 if ( $actionComment == '' ) {
303 $actionComment = $comment;
304 } else {
305 $actionComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
306 }
307 }
308
309 return $actionComment;
310 }
311
319 public function getIRCActionText() {
320 $this->plaintext = true;
321 $this->irctext = true;
322
323 $entry = $this->entry;
324 $parameters = $entry->getParameters();
325 // @see LogPage::actionText()
326 // Text of title the action is aimed at.
327 $target = $entry->getTarget()->getPrefixedText();
328 $text = null;
329 $contLang = $this->getContentLanguage();
330 switch ( $entry->getType() ) {
331 case 'move':
332 switch ( $entry->getSubtype() ) {
333 case 'move':
334 $movesource = $parameters['4::target'];
335 $text = wfMessage( '1movedto2' )
336 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
337 break;
338 case 'move_redir':
339 $movesource = $parameters['4::target'];
340 $text = wfMessage( '1movedto2_redir' )
341 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
342 break;
343 case 'move-noredirect':
344 break;
345 case 'move_redir-noredirect':
346 break;
347 }
348 break;
349
350 case 'delete':
351 switch ( $entry->getSubtype() ) {
352 case 'delete':
353 $text = wfMessage( 'deletedarticle' )
354 ->rawParams( $target )->inContentLanguage()->escaped();
355 break;
356 case 'restore':
357 $text = wfMessage( 'undeletedarticle' )
358 ->rawParams( $target )->inContentLanguage()->escaped();
359 break;
360 }
361 break;
362
363 case 'patrol':
364 // https://github.com/wikimedia/mediawiki/commit/1a05f8faf78675dc85984f27f355b8825b43efff
365 // Create a diff link to the patrolled revision
366 if ( $entry->getSubtype() === 'patrol' ) {
367 $diffLink = htmlspecialchars(
368 wfMessage( 'patrol-log-diff', $parameters['4::curid'] )
369 ->inContentLanguage()->text() );
370 $text = wfMessage( 'patrol-log-line', $diffLink, "[[$target]]", "" )
371 ->inContentLanguage()->text();
372 } else {
373 // broken??
374 }
375 break;
376
377 case 'protect':
378 switch ( $entry->getSubtype() ) {
379 case 'protect':
380 $text = wfMessage( 'protectedarticle' )
381 ->rawParams( $target . ' ' . $parameters['4::description'] )
382 ->inContentLanguage()
383 ->escaped();
384 break;
385 case 'unprotect':
386 $text = wfMessage( 'unprotectedarticle' )
387 ->rawParams( $target )->inContentLanguage()->escaped();
388 break;
389 case 'modify':
390 $text = wfMessage( 'modifiedarticleprotection' )
391 ->rawParams( $target . ' ' . $parameters['4::description'] )
392 ->inContentLanguage()
393 ->escaped();
394 break;
395 case 'move_prot':
396 $text = wfMessage( 'movedarticleprotection' )
397 ->rawParams( $target, $parameters['4::oldtitle'] )->inContentLanguage()->escaped();
398 break;
399 }
400 break;
401
402 case 'newusers':
403 switch ( $entry->getSubtype() ) {
404 case 'newusers':
405 case 'create':
406 $text = wfMessage( 'newuserlog-create-entry' )
407 ->inContentLanguage()->escaped();
408 break;
409 case 'create2':
410 case 'byemail':
411 $text = wfMessage( 'newuserlog-create2-entry' )
412 ->rawParams( $target )->inContentLanguage()->escaped();
413 break;
414 case 'autocreate':
415 $text = wfMessage( 'newuserlog-autocreate-entry' )
416 ->inContentLanguage()->escaped();
417 break;
418 }
419 break;
420
421 case 'upload':
422 switch ( $entry->getSubtype() ) {
423 case 'upload':
424 $text = wfMessage( 'uploadedimage' )
425 ->rawParams( $target )->inContentLanguage()->escaped();
426 break;
427 case 'overwrite':
428 case 'revert':
429 $text = wfMessage( 'overwroteimage' )
430 ->rawParams( $target )->inContentLanguage()->escaped();
431 break;
432 }
433 break;
434
435 case 'rights':
436 if ( count( $parameters['4::oldgroups'] ) ) {
437 $oldgroups = implode( ', ', $parameters['4::oldgroups'] );
438 } else {
439 $oldgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
440 }
441 if ( count( $parameters['5::newgroups'] ) ) {
442 $newgroups = implode( ', ', $parameters['5::newgroups'] );
443 } else {
444 $newgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
445 }
446 switch ( $entry->getSubtype() ) {
447 case 'rights':
448 $text = wfMessage( 'rightslogentry' )
449 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
450 break;
451 case 'autopromote':
452 $text = wfMessage( 'rightslogentry-autopromote' )
453 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
454 break;
455 }
456 break;
457
458 case 'merge':
459 switch ( $entry->getSubtype() ) {
460 case 'merge':
461 $text = wfMessage( 'pagemerge-logentry' )
462 ->rawParams( $target, $parameters['4::dest'], $parameters['5::mergepoint'] )
463 ->inContentLanguage()->escaped();
464 break;
465
466 case 'merge-into':
467 // Nothing for IRC (already covered by the log at the source page)
468 return '';
469 }
470 break;
471
472 case 'block':
473 switch ( $entry->getSubtype() ) {
474 case 'block':
475 // Keep compatibility with extensions by checking for
476 // new key (5::duration/6::flags) or old key (0/optional 1)
477 if ( $entry->isLegacy() ) {
478 $rawDuration = $parameters[0];
479 $rawFlags = $parameters[1] ?? '';
480 } else {
481 $rawDuration = $parameters['5::duration'];
482 $rawFlags = $parameters['6::flags'];
483 }
484 $duration = $contLang->translateBlockExpiry(
485 $rawDuration,
486 null,
487 (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
488 );
489 $flags = BlockLogFormatter::formatBlockFlags( $rawFlags, $contLang );
490 $text = wfMessage( 'blocklogentry' )
491 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
492 break;
493 case 'unblock':
494 $text = wfMessage( 'unblocklogentry' )
495 ->rawParams( $target )->inContentLanguage()->escaped();
496 break;
497 case 'reblock':
498 $duration = $contLang->translateBlockExpiry(
499 $parameters['5::duration'],
500 null,
501 (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
502 );
503 $flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'],
504 $contLang );
505 $text = wfMessage( 'reblock-logentry' )
506 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
507 break;
508 }
509 break;
510
511 case 'import':
512 switch ( $entry->getSubtype() ) {
513 case 'upload':
514 $text = wfMessage( 'import-logentry-upload' )
515 ->rawParams( $target )->inContentLanguage()->escaped();
516 break;
517 case 'interwiki':
518 $text = wfMessage( 'import-logentry-interwiki' )
519 ->rawParams( $target )->inContentLanguage()->escaped();
520 break;
521 }
522 break;
523 // case 'suppress' --private log -- aaron (so we know who to blame in a few years :-D)
524 // default:
525 }
526
527 $this->plaintext = false;
528 $this->irctext = false;
529
530 return $text ?? $this->getPlainActionText();
531 }
532
540 public function getActionText() {
541 if ( $this->canView( LogPage::DELETED_ACTION ) ) {
542 $element = $this->getActionMessage();
543 if ( $element instanceof Message ) {
544 $element = $this->plaintext ? $element->text() : $element->escaped();
545 }
546 if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
547 $element = $this->styleRestrictedElement( $element );
548 }
549 } else {
550 $sep = $this->msg( 'word-separator' );
551 $sep = $this->plaintext ? $sep->text() : $sep->escaped();
552 $performer = $this->getPerformerElement();
553 $element = $performer . $sep . $this->getRestrictedElement( 'rev-deleted-event' );
554 }
555
556 return $element;
557 }
558
565 protected function getActionMessage() {
566 $message = $this->msg( $this->getMessageKey() );
567 $message->params( $this->getMessageParameters() );
568
569 return $message;
570 }
571
580 protected function getMessageKey() {
581 $type = $this->entry->getType();
582 $subtype = $this->entry->getSubtype();
583
584 return "logentry-$type-$subtype";
585 }
586
593 public function getActionLinks() {
594 return '';
595 }
596
603 protected function extractParameters() {
604 $entry = $this->entry;
605 $params = [];
606
607 if ( $entry->isLegacy() ) {
608 foreach ( $entry->getParameters() as $index => $value ) {
609 $params[$index + 3] = $value;
610 }
611 }
612
613 // Filter out parameters which are not in format #:foo
614 foreach ( $entry->getParameters() as $key => $value ) {
615 if ( !str_contains( $key, ':' ) ) {
616 continue;
617 }
618 [ $index, $type, ] = explode( ':', $key, 3 );
619 if ( ctype_digit( $index ) ) {
620 $params[(int)$index - 1] = $this->formatParameterValue( $type, $value );
621 }
622 }
623
624 /* Message class doesn't like non consecutive numbering.
625 * Fill in missing indexes with empty strings to avoid
626 * incorrect renumbering.
627 */
628 if ( count( $params ) ) {
629 $max = max( array_keys( $params ) );
630 // index 0 to 2 are added in getMessageParameters
631 for ( $i = 3; $i < $max; $i++ ) {
632 if ( !isset( $params[$i] ) ) {
633 $params[$i] = '';
634 }
635 }
636 }
637
638 return $params;
639 }
640
658 protected function getMessageParameters() {
659 if ( $this->parsedParameters !== null ) {
660 return $this->parsedParameters;
661 }
662
663 $entry = $this->entry;
664 $params = $this->extractParameters();
665 $params[0] = Message::rawParam( $this->getPerformerElement() );
666 $params[1] = $this->canView( LogPage::DELETED_USER ) ? $entry->getPerformerIdentity()->getName() : '';
667 $params[2] = Message::rawParam( $this->makePageLink( $entry->getTarget() ) );
668
669 // Bad things happens if the numbers are not in correct order
670 ksort( $params );
671
672 $this->parsedParameters = $params;
673 return $this->parsedParameters;
674 }
675
702 protected function formatParameterValue( $type, $value ) {
703 $saveLinkFlood = $this->linkFlood;
704
705 switch ( strtolower( trim( $type ) ) ) {
706 case 'raw':
707 $value = Message::rawParam( $value );
708 break;
709 case 'list':
710 $value = $this->context->getLanguage()->commaList( $value );
711 break;
712 case 'msg':
713 $value = $this->msg( $value )->text();
714 break;
715 case 'msg-content':
716 $value = $this->msg( $value )->inContentLanguage()->text();
717 break;
718 case 'number':
719 $value = Message::numParam( $value );
720 break;
721 case 'user':
722 $user = User::newFromName( $value );
723 $value = $user->getName();
724 break;
725 case 'user-link':
726 $this->setShowUserToolLinks( false );
727
728 $user = User::newFromName( $value );
729
730 if ( !$user ) {
731 $value = $this->msg( 'empty-username' )->text();
732 } else {
733 $value = Message::rawParam( $this->makeUserLink( $user ) );
734 $this->setShowUserToolLinks( $saveLinkFlood );
735 }
736 break;
737 case 'title':
738 $title = Title::newFromText( $value );
739 $value = $title->getPrefixedText();
740 break;
741 case 'title-link':
742 $title = Title::newFromText( $value );
743 $value = Message::rawParam( $this->makePageLink( $title ) );
744 break;
745 case 'plain':
746 // Plain text, nothing to do
747 default:
748 // Catch other types and use the old behavior (return as-is)
749 }
750
751 return $value;
752 }
753
764 protected function makePageLink( ?Title $title = null, $parameters = [], $html = null ) {
765 if ( !$title instanceof Title ) {
766 $msg = $this->msg( 'invalidtitle' )->text();
767 if ( $this->plaintext ) {
768 return $msg;
769 } else {
770 return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ], $msg );
771 }
772 }
773
774 if ( $this->plaintext ) {
775 $link = '[[' . $title->getPrefixedText() . ']]';
776 } else {
777 $html = $html !== null ? new HtmlArmor( $html ) : $html;
778 $link = $this->getLinkRenderer()->makeLink( $title, $html, [], $parameters );
779 }
780
781 return $link;
782 }
783
790 public function getPerformerElement() {
791 if ( $this->canView( LogPage::DELETED_USER ) ) {
792 $performerIdentity = $this->entry->getPerformerIdentity();
793 $element = $this->makeUserLink( $performerIdentity );
794 if ( $this->entry->isDeleted( LogPage::DELETED_USER ) ) {
795 $element = $this->styleRestrictedElement( $element );
796 }
797 } else {
798 $element = $this->getRestrictedElement( 'rev-deleted-user' );
799 }
800
801 return $element;
802 }
803
809 public function getComment() {
810 if ( $this->canView( LogPage::DELETED_COMMENT ) ) {
811 $comment = $this->getCommentFormatter()
812 ->formatBlock( $this->entry->getComment() );
813 // No hard coded spaces thanx
814 $element = ltrim( $comment );
815 if ( $this->entry->isDeleted( LogPage::DELETED_COMMENT ) ) {
816 $element = $this->styleRestrictedElement( $element );
817 }
818 } else {
819 $element = $this->getRestrictedElement( 'rev-deleted-comment' );
820 }
821
822 return $element;
823 }
824
831 protected function getRestrictedElement( $message ) {
832 if ( $this->plaintext ) {
833 return $this->msg( $message )->text();
834 }
835
836 return $this->styleRestrictedElement( $this->msg( $message )->escaped() );
837 }
838
844 protected function styleRestrictedElement( $content ) {
845 if ( $this->plaintext ) {
846 return $content;
847 }
848 $attribs = [ 'class' => [ 'history-deleted' ] ];
849 if ( $this->entry->isDeleted( LogPage::DELETED_RESTRICTED ) ) {
850 $attribs['class'][] = 'mw-history-suppressed';
851 }
852
853 return Html::rawElement( 'span', $attribs, $content );
854 }
855
864 protected function msg( $key, ...$params ) {
865 return $this->context->msg( $key, ...$params );
866 }
867
874 protected function makeUserLink( UserIdentity $user, $toolFlags = 0 ) {
875 if ( $this->plaintext ) {
876 $element = $user->getName();
877 } else {
878 $element = Linker::userLink(
879 $user->getId(),
880 $user->getName()
881 );
882 if ( $this->linkFlood ) {
883 $editCount = $this->getUserEditTracker()->getUserEditCount( $user );
884
885 $element .= Linker::userToolLinks(
886 $user->getId(),
887 $user->getName(),
888 true, // redContribsWhenNoEdits
889 $toolFlags,
890 $editCount,
891 // do not render parentheses in the HTML markup (CSS will provide)
892 false
893 );
894 }
895 }
896
897 return $element;
898 }
899
904 public function getPreloadTitles() {
905 return [];
906 }
907
912 // This function was added because getMessageParameters() is
913 // protected and a change from protected to public caused
914 // problems with extensions
915 return $this->getMessageParameters();
916 }
917
924 protected function getParametersForApi() {
925 return $this->entry->getParameters();
926 }
927
943 public function formatParametersForApi() {
944 $logParams = [];
945 foreach ( $this->getParametersForApi() as $key => $value ) {
946 $vals = explode( ':', $key, 3 );
947 if ( count( $vals ) !== 3 ) {
948 if ( $value instanceof \__PHP_Incomplete_Class ) {
949 wfLogWarning( 'Log entry of type ' . $this->entry->getFullType() .
950 ' contains unrecoverable extra parameters.' );
951 continue;
952 }
953 $logParams[$key] = $value;
954 continue;
955 }
956 $logParams += $this->formatParameterValueForApi( $vals[2], $vals[1], $value );
957 }
958 ApiResult::setIndexedTagName( $logParams, 'param' );
959 ApiResult::setArrayType( $logParams, 'assoc' );
960
961 return $logParams;
962 }
963
973 protected function formatParameterValueForApi( $name, $type, $value ) {
974 $type = strtolower( trim( $type ) );
975 switch ( $type ) {
976 case 'bool':
977 $value = (bool)$value;
978 break;
979
980 case 'number':
981 if ( is_int( $value ) || ctype_digit( (string)$value ) ) {
982 $value = (int)$value;
983 } else {
984 $value = (float)$value;
985 }
986 break;
987
988 case 'array':
989 case 'assoc':
990 case 'kvp':
991 if ( is_array( $value ) ) {
992 ApiResult::setArrayType( $value, $type );
993 }
994 break;
995
996 case 'timestamp':
997 $value = wfTimestamp( TS_ISO_8601, $value );
998 break;
999
1000 case 'msg':
1001 case 'msg-content':
1002 $msg = $this->msg( $value );
1003 if ( $type === 'msg-content' ) {
1004 $msg->inContentLanguage();
1005 }
1006 $value = [];
1007 $value["{$name}_key"] = $msg->getKey();
1008 if ( $msg->getParams() ) {
1009 $value["{$name}_params"] = $msg->getParams();
1010 }
1011 $value["{$name}_text"] = $msg->text();
1012 return $value;
1013
1014 case 'title':
1015 case 'title-link':
1016 $title = Title::newFromText( $value );
1017 if ( !$title ) {
1018 $title = SpecialPage::getTitleFor( 'Badtitle', $value );
1019 }
1020 $value = [];
1021 ApiQueryBase::addTitleInfo( $value, $title, "{$name}_" );
1022 return $value;
1023
1024 case 'user':
1025 case 'user-link':
1026 $user = User::newFromName( $value );
1027 if ( $user ) {
1028 $value = $user->getName();
1029 }
1030 break;
1031
1032 default:
1033 // do nothing
1034 break;
1035 }
1036
1037 return [ $name => $value ];
1038 }
1039}
1040
1042class_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:68
This is a base class for all Query modules.
This class represents the result of the API operations.
Definition ApiResult.php:32
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:43
Base class for language-specific code.
Definition Language.php:69
Class that generates HTML for internal links.
Some internal bits split of from Skin.php.
Definition Linker.php:47
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:144
Parent class for all special pages.
Represents a title within MediaWiki.
Definition Title.php:69
Track info about user edit counts and timings.
User class for the MediaWiki software.
Definition User.php:108
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:18
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:23
Interface for objects representing user identity.
getId( $wikiId=self::LOCAL)