MediaWiki master
LogFormatter.php
Go to the documentation of this file.
1<?php
41
55 // Audience options for viewing usernames, comments, and actions
56 public const FOR_PUBLIC = 1;
57 public const FOR_THIS_USER = 2;
58
59 // Static->
60
67 public static function newFromEntry( LogEntry $entry ) {
68 wfDeprecated( __METHOD__, '1.42' );
69 return MediaWikiServices::getInstance()->getLogFormatterFactory()->newFromEntry( $entry );
70 }
71
80 public static function newFromRow( $row ) {
81 wfDeprecated( __METHOD__, '1.42' );
82 return self::newFromEntry( DatabaseLogEntry::newFromRow( $row ) );
83 }
84
85 // Nonstatic->
86
88 protected $entry;
89
91 protected $audience = self::FOR_PUBLIC;
92
94 public $context;
95
97 protected $linkFlood = false;
98
106 protected $plaintext = false;
107
109 protected $irctext = false;
110
112 private $linkRenderer;
113
115 private $contentLanguage;
116
118 private $commentFormatter;
119
121 private $userEditTracker;
122
128
134 public function __construct( LogEntry $entry ) {
135 $this->entry = $entry;
136 $this->context = RequestContext::getMain();
137 }
138
143 public function setContext( IContextSource $context ) {
144 $this->context = $context;
145 }
146
151 public function setLinkRenderer( LinkRenderer $linkRenderer ) {
152 $this->linkRenderer = $linkRenderer;
153 }
154
159 public function getLinkRenderer() {
160 if ( $this->linkRenderer !== null ) {
161 return $this->linkRenderer;
162 } else {
163 wfDeprecated( static::class . " without all required services", '1.42' );
164 return MediaWikiServices::getInstance()->getLinkRenderer();
165 }
166 }
167
173 final public function setContentLanguage( Language $contentLanguage ) {
174 $this->contentLanguage = $contentLanguage;
175 }
176
181 final public function getContentLanguage(): Language {
182 if ( $this->contentLanguage === null ) {
183 wfDeprecated( static::class . " without all required services", '1.42' );
184 $this->contentLanguage = MediaWikiServices::getInstance()->getContentLanguage();
185 }
186 return $this->contentLanguage;
187 }
188
194 final public function setCommentFormatter( CommentFormatter $commentFormatter ) {
195 $this->commentFormatter = $commentFormatter;
196 }
197
202 final public function getCommentFormatter(): CommentFormatter {
203 if ( $this->commentFormatter === null ) {
204 wfDeprecated( static::class . " without all required services", '1.42' );
205 $this->commentFormatter = MediaWikiServices::getInstance()->getCommentFormatter();
206 }
207 return $this->commentFormatter;
208 }
209
215 final public function setUserEditTracker( UserEditTracker $userEditTracker ) {
216 $this->userEditTracker = $userEditTracker;
217 }
218
223 final public function getUserEditTracker(): UserEditTracker {
224 if ( $this->userEditTracker === null ) {
225 wfDeprecated( static::class . " without all required services", '1.42' );
226 $this->userEditTracker = MediaWikiServices::getInstance()->getUserEditTracker();
227 }
228 return $this->userEditTracker;
229 }
230
237 public function setAudience( $audience ) {
238 $this->audience = ( $audience == self::FOR_THIS_USER )
239 ? self::FOR_THIS_USER
240 : self::FOR_PUBLIC;
241 }
242
247 public function canViewLogType() {
248 // If the user doesn't have the right permission to view the specific
249 // log type, return false
250 $logRestrictions = $this->context->getConfig()->get( MainConfigNames::LogRestrictions );
251 $type = $this->entry->getType();
252 return !isset( $logRestrictions[$type] )
253 || $this->context->getAuthority()->isAllowed( $logRestrictions[$type] );
254 }
255
261 protected function canView( $field ) {
262 if ( $this->audience == self::FOR_THIS_USER ) {
263 return LogEventsList::userCanBitfield(
264 $this->entry->getDeleted(), $field, $this->context->getAuthority() ) &&
265 self::canViewLogType();
266 } else {
267 return !$this->entry->isDeleted( $field ) && self::canViewLogType();
268 }
269 }
270
277 public function setShowUserToolLinks( $value ) {
278 $this->linkFlood = $value;
279 }
280
289 public function getPlainActionText() {
290 $this->plaintext = true;
291 $text = $this->getActionText();
292 $this->plaintext = false;
293
294 return $text;
295 }
296
303 public function getIRCActionComment() {
304 $actionComment = $this->getIRCActionText();
305 $comment = $this->entry->getComment();
306
307 if ( $comment != '' ) {
308 if ( $actionComment == '' ) {
309 $actionComment = $comment;
310 } else {
311 $actionComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
312 }
313 }
314
315 return $actionComment;
316 }
317
325 public function getIRCActionText() {
326 $this->plaintext = true;
327 $this->irctext = true;
328
329 $entry = $this->entry;
330 $parameters = $entry->getParameters();
331 // @see LogPage::actionText()
332 // Text of title the action is aimed at.
333 $target = $entry->getTarget()->getPrefixedText();
334 $text = null;
335 $contLang = $this->getContentLanguage();
336 switch ( $entry->getType() ) {
337 case 'move':
338 switch ( $entry->getSubtype() ) {
339 case 'move':
340 $movesource = $parameters['4::target'];
341 $text = wfMessage( '1movedto2' )
342 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
343 break;
344 case 'move_redir':
345 $movesource = $parameters['4::target'];
346 $text = wfMessage( '1movedto2_redir' )
347 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
348 break;
349 case 'move-noredirect':
350 break;
351 case 'move_redir-noredirect':
352 break;
353 }
354 break;
355
356 case 'delete':
357 switch ( $entry->getSubtype() ) {
358 case 'delete':
359 $text = wfMessage( 'deletedarticle' )
360 ->rawParams( $target )->inContentLanguage()->escaped();
361 break;
362 case 'restore':
363 $text = wfMessage( 'undeletedarticle' )
364 ->rawParams( $target )->inContentLanguage()->escaped();
365 break;
366 }
367 break;
368
369 case 'patrol':
370 // https://github.com/wikimedia/mediawiki/commit/1a05f8faf78675dc85984f27f355b8825b43efff
371 // Create a diff link to the patrolled revision
372 if ( $entry->getSubtype() === 'patrol' ) {
373 $diffLink = htmlspecialchars(
374 wfMessage( 'patrol-log-diff', $parameters['4::curid'] )
375 ->inContentLanguage()->text() );
376 $text = wfMessage( 'patrol-log-line', $diffLink, "[[$target]]", "" )
377 ->inContentLanguage()->text();
378 } else {
379 // broken??
380 }
381 break;
382
383 case 'protect':
384 switch ( $entry->getSubtype() ) {
385 case 'protect':
386 $text = wfMessage( 'protectedarticle' )
387 ->rawParams( $target . ' ' . $parameters['4::description'] )
388 ->inContentLanguage()
389 ->escaped();
390 break;
391 case 'unprotect':
392 $text = wfMessage( 'unprotectedarticle' )
393 ->rawParams( $target )->inContentLanguage()->escaped();
394 break;
395 case 'modify':
396 $text = wfMessage( 'modifiedarticleprotection' )
397 ->rawParams( $target . ' ' . $parameters['4::description'] )
398 ->inContentLanguage()
399 ->escaped();
400 break;
401 case 'move_prot':
402 $text = wfMessage( 'movedarticleprotection' )
403 ->rawParams( $target, $parameters['4::oldtitle'] )->inContentLanguage()->escaped();
404 break;
405 }
406 break;
407
408 case 'newusers':
409 switch ( $entry->getSubtype() ) {
410 case 'newusers':
411 case 'create':
412 $text = wfMessage( 'newuserlog-create-entry' )
413 ->inContentLanguage()->escaped();
414 break;
415 case 'create2':
416 case 'byemail':
417 $text = wfMessage( 'newuserlog-create2-entry' )
418 ->rawParams( $target )->inContentLanguage()->escaped();
419 break;
420 case 'autocreate':
421 $text = wfMessage( 'newuserlog-autocreate-entry' )
422 ->inContentLanguage()->escaped();
423 break;
424 }
425 break;
426
427 case 'upload':
428 switch ( $entry->getSubtype() ) {
429 case 'upload':
430 $text = wfMessage( 'uploadedimage' )
431 ->rawParams( $target )->inContentLanguage()->escaped();
432 break;
433 case 'overwrite':
434 case 'revert':
435 $text = wfMessage( 'overwroteimage' )
436 ->rawParams( $target )->inContentLanguage()->escaped();
437 break;
438 }
439 break;
440
441 case 'rights':
442 if ( count( $parameters['4::oldgroups'] ) ) {
443 $oldgroups = implode( ', ', $parameters['4::oldgroups'] );
444 } else {
445 $oldgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
446 }
447 if ( count( $parameters['5::newgroups'] ) ) {
448 $newgroups = implode( ', ', $parameters['5::newgroups'] );
449 } else {
450 $newgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
451 }
452 switch ( $entry->getSubtype() ) {
453 case 'rights':
454 $text = wfMessage( 'rightslogentry' )
455 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
456 break;
457 case 'autopromote':
458 $text = wfMessage( 'rightslogentry-autopromote' )
459 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
460 break;
461 }
462 break;
463
464 case 'merge':
465 $text = wfMessage( 'pagemerge-logentry' )
466 ->rawParams( $target, $parameters['4::dest'], $parameters['5::mergepoint'] )
467 ->inContentLanguage()->escaped();
468 break;
469
470 case 'block':
471 switch ( $entry->getSubtype() ) {
472 case 'block':
473 // Keep compatibility with extensions by checking for
474 // new key (5::duration/6::flags) or old key (0/optional 1)
475 if ( $entry->isLegacy() ) {
476 $rawDuration = $parameters[0];
477 $rawFlags = $parameters[1] ?? '';
478 } else {
479 $rawDuration = $parameters['5::duration'];
480 $rawFlags = $parameters['6::flags'];
481 }
482 $duration = $contLang->translateBlockExpiry(
483 $rawDuration,
484 null,
485 (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
486 );
487 $flags = BlockLogFormatter::formatBlockFlags( $rawFlags, $contLang );
488 $text = wfMessage( 'blocklogentry' )
489 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
490 break;
491 case 'unblock':
492 $text = wfMessage( 'unblocklogentry' )
493 ->rawParams( $target )->inContentLanguage()->escaped();
494 break;
495 case 'reblock':
496 $duration = $contLang->translateBlockExpiry(
497 $parameters['5::duration'],
498 null,
499 (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
500 );
501 $flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'],
502 $contLang );
503 $text = wfMessage( 'reblock-logentry' )
504 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
505 break;
506 }
507 break;
508
509 case 'import':
510 switch ( $entry->getSubtype() ) {
511 case 'upload':
512 $text = wfMessage( 'import-logentry-upload' )
513 ->rawParams( $target )->inContentLanguage()->escaped();
514 break;
515 case 'interwiki':
516 $text = wfMessage( 'import-logentry-interwiki' )
517 ->rawParams( $target )->inContentLanguage()->escaped();
518 break;
519 }
520 break;
521 // case 'suppress' --private log -- aaron (so we know who to blame in a few years :-D)
522 // default:
523 }
524
525 $this->plaintext = false;
526 $this->irctext = false;
527
528 return $text ?? $this->getPlainActionText();
529 }
530
538 public function getActionText() {
539 if ( $this->canView( LogPage::DELETED_ACTION ) ) {
540 $element = $this->getActionMessage();
541 if ( $element instanceof Message ) {
542 $element = $this->plaintext ? $element->text() : $element->escaped();
543 }
544 if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
545 $element = $this->styleRestrictedElement( $element );
546 }
547 } else {
548 $sep = $this->msg( 'word-separator' );
549 $sep = $this->plaintext ? $sep->text() : $sep->escaped();
550 $performer = $this->getPerformerElement();
551 $element = $performer . $sep . $this->getRestrictedElement( 'rev-deleted-event' );
552 }
553
554 return $element;
555 }
556
563 protected function getActionMessage() {
564 $message = $this->msg( $this->getMessageKey() );
565 $message->params( $this->getMessageParameters() );
566
567 return $message;
568 }
569
578 protected function getMessageKey() {
579 $type = $this->entry->getType();
580 $subtype = $this->entry->getSubtype();
581
582 return "logentry-$type-$subtype";
583 }
584
591 public function getActionLinks() {
592 return '';
593 }
594
601 protected function extractParameters() {
602 $entry = $this->entry;
603 $params = [];
604
605 if ( $entry->isLegacy() ) {
606 foreach ( $entry->getParameters() as $index => $value ) {
607 $params[$index + 3] = $value;
608 }
609 }
610
611 // Filter out parameters which are not in format #:foo
612 foreach ( $entry->getParameters() as $key => $value ) {
613 if ( strpos( $key, ':' ) === false ) {
614 continue;
615 }
616 [ $index, $type, ] = explode( ':', $key, 3 );
617 if ( ctype_digit( $index ) ) {
618 $params[(int)$index - 1] = $this->formatParameterValue( $type, $value );
619 }
620 }
621
622 /* Message class doesn't like non consecutive numbering.
623 * Fill in missing indexes with empty strings to avoid
624 * incorrect renumbering.
625 */
626 if ( count( $params ) ) {
627 $max = max( array_keys( $params ) );
628 // index 0 to 2 are added in getMessageParameters
629 for ( $i = 3; $i < $max; $i++ ) {
630 if ( !isset( $params[$i] ) ) {
631 $params[$i] = '';
632 }
633 }
634 }
635
636 return $params;
637 }
638
656 protected function getMessageParameters() {
657 if ( isset( $this->parsedParameters ) ) {
658 return $this->parsedParameters;
659 }
660
661 $entry = $this->entry;
662 $params = $this->extractParameters();
663 $params[0] = Message::rawParam( $this->getPerformerElement() );
664 $params[1] = $this->canView( LogPage::DELETED_USER ) ? $entry->getPerformerIdentity()->getName() : '';
665 $params[2] = Message::rawParam( $this->makePageLink( $entry->getTarget() ) );
666
667 // Bad things happens if the numbers are not in correct order
668 ksort( $params );
669
670 $this->parsedParameters = $params;
671 return $this->parsedParameters;
672 }
673
700 protected function formatParameterValue( $type, $value ) {
701 $saveLinkFlood = $this->linkFlood;
702
703 switch ( strtolower( trim( $type ) ) ) {
704 case 'raw':
705 $value = Message::rawParam( $value );
706 break;
707 case 'list':
708 $value = $this->context->getLanguage()->commaList( $value );
709 break;
710 case 'msg':
711 $value = $this->msg( $value )->text();
712 break;
713 case 'msg-content':
714 $value = $this->msg( $value )->inContentLanguage()->text();
715 break;
716 case 'number':
717 $value = Message::numParam( $value );
718 break;
719 case 'user':
720 $user = User::newFromName( $value );
721 $value = $user->getName();
722 break;
723 case 'user-link':
724 $this->setShowUserToolLinks( false );
725
726 $user = User::newFromName( $value );
727
728 if ( !$user ) {
729 $value = $this->msg( 'empty-username' )->text();
730 } else {
731 $value = Message::rawParam( $this->makeUserLink( $user ) );
732 $this->setShowUserToolLinks( $saveLinkFlood );
733 }
734 break;
735 case 'title':
736 $title = Title::newFromText( $value );
737 $value = $title->getPrefixedText();
738 break;
739 case 'title-link':
740 $title = Title::newFromText( $value );
741 $value = Message::rawParam( $this->makePageLink( $title ) );
742 break;
743 case 'plain':
744 // Plain text, nothing to do
745 default:
746 // Catch other types and use the old behavior (return as-is)
747 }
748
749 return $value;
750 }
751
762 protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
763 if ( !$title instanceof Title ) {
764 $msg = $this->msg( 'invalidtitle' )->text();
765 if ( $this->plaintext ) {
766 return $msg;
767 } else {
768 return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ], $msg );
769 }
770 }
771
772 if ( $this->plaintext ) {
773 $link = '[[' . $title->getPrefixedText() . ']]';
774 } else {
775 $html = $html !== null ? new HtmlArmor( $html ) : $html;
776 $link = $this->getLinkRenderer()->makeLink( $title, $html, [], $parameters );
777 }
778
779 return $link;
780 }
781
788 public function getPerformerElement() {
789 if ( $this->canView( LogPage::DELETED_USER ) ) {
790 $performerIdentity = $this->entry->getPerformerIdentity();
791 $element = $this->makeUserLink( $performerIdentity );
792 if ( $this->entry->isDeleted( LogPage::DELETED_USER ) ) {
793 $element = $this->styleRestrictedElement( $element );
794 }
795 } else {
796 $element = $this->getRestrictedElement( 'rev-deleted-user' );
797 }
798
799 return $element;
800 }
801
807 public function getComment() {
808 if ( $this->canView( LogPage::DELETED_COMMENT ) ) {
809 $comment = $this->getCommentFormatter()
810 ->formatBlock( $this->entry->getComment() );
811 // No hard coded spaces thanx
812 $element = ltrim( $comment );
813 if ( $this->entry->isDeleted( LogPage::DELETED_COMMENT ) ) {
814 $element = $this->styleRestrictedElement( $element );
815 }
816 } else {
817 $element = $this->getRestrictedElement( 'rev-deleted-comment' );
818 }
819
820 return $element;
821 }
822
829 protected function getRestrictedElement( $message ) {
830 if ( $this->plaintext ) {
831 return $this->msg( $message )->text();
832 }
833
834 return $this->styleRestrictedElement( $this->msg( $message )->escaped() );
835 }
836
842 protected function styleRestrictedElement( $content ) {
843 if ( $this->plaintext ) {
844 return $content;
845 }
846 $attribs = [ 'class' => [ 'history-deleted' ] ];
847 if ( $this->entry->isDeleted( LogPage::DELETED_RESTRICTED ) ) {
848 $attribs['class'][] = 'mw-history-suppressed';
849 }
850
851 return Html::rawElement( 'span', $attribs, $content );
852 }
853
860 protected function msg( $key, ...$params ) {
861 return $this->context->msg( $key, ...$params );
862 }
863
870 protected function makeUserLink( UserIdentity $user, $toolFlags = 0 ) {
871 if ( $this->plaintext ) {
872 $element = $user->getName();
873 } else {
874 $element = Linker::userLink(
875 $user->getId(),
876 $user->getName()
877 );
878 if ( $this->linkFlood ) {
879 $editCount = $this->getUserEditTracker()->getUserEditCount( $user );
880
881 $element .= Linker::userToolLinks(
882 $user->getId(),
883 $user->getName(),
884 true, // redContribsWhenNoEdits
885 $toolFlags,
886 $editCount,
887 // do not render parentheses in the HTML markup (CSS will provide)
888 false
889 );
890 }
891 }
892
893 return $element;
894 }
895
900 public function getPreloadTitles() {
901 return [];
902 }
903
908 // This function was added because getMessageParameters() is
909 // protected and a change from protected to public caused
910 // problems with extensions
911 return $this->getMessageParameters();
912 }
913
920 protected function getParametersForApi() {
921 return $this->entry->getParameters();
922 }
923
939 public function formatParametersForApi() {
940 $logParams = [];
941 foreach ( $this->getParametersForApi() as $key => $value ) {
942 $vals = explode( ':', $key, 3 );
943 if ( count( $vals ) !== 3 ) {
944 if ( $value instanceof __PHP_Incomplete_Class ) {
945 wfLogWarning( 'Log entry of type ' . $this->entry->getFullType() .
946 ' contains unrecoverable extra parameters.' );
947 continue;
948 }
949 $logParams[$key] = $value;
950 continue;
951 }
952 $logParams += $this->formatParameterValueForApi( $vals[2], $vals[1], $value );
953 }
954 ApiResult::setIndexedTagName( $logParams, 'param' );
955 ApiResult::setArrayType( $logParams, 'assoc' );
956
957 return $logParams;
958 }
959
969 protected function formatParameterValueForApi( $name, $type, $value ) {
970 $type = strtolower( trim( $type ) );
971 switch ( $type ) {
972 case 'bool':
973 $value = (bool)$value;
974 break;
975
976 case 'number':
977 if ( is_int( $value ) || ctype_digit( (string)$value ) ) {
978 $value = (int)$value;
979 } else {
980 $value = (float)$value;
981 }
982 break;
983
984 case 'array':
985 case 'assoc':
986 case 'kvp':
987 if ( is_array( $value ) ) {
988 ApiResult::setArrayType( $value, $type );
989 }
990 break;
991
992 case 'timestamp':
993 $value = wfTimestamp( TS_ISO_8601, $value );
994 break;
995
996 case 'msg':
997 case 'msg-content':
998 $msg = $this->msg( $value );
999 if ( $type === 'msg-content' ) {
1000 $msg->inContentLanguage();
1001 }
1002 $value = [];
1003 $value["{$name}_key"] = $msg->getKey();
1004 if ( $msg->getParams() ) {
1005 $value["{$name}_params"] = $msg->getParams();
1006 }
1007 $value["{$name}_text"] = $msg->text();
1008 return $value;
1009
1010 case 'title':
1011 case 'title-link':
1012 $title = Title::newFromText( $value );
1013 if ( !$title ) {
1014 $title = SpecialPage::getTitleFor( 'Badtitle', $value );
1015 }
1016 $value = [];
1017 ApiQueryBase::addTitleInfo( $value, $title, "{$name}_" );
1018 return $value;
1019
1020 case 'user':
1021 case 'user-link':
1022 $user = User::newFromName( $value );
1023 if ( $user ) {
1024 $value = $user->getName();
1025 }
1026 break;
1027
1028 default:
1029 // do nothing
1030 break;
1031 }
1032
1033 return [ $name => $value ];
1034 }
1035}
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.
array $params
The job parameters.
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:81
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:30
Extends the LogEntry Interface with some basic functionality.
Implements the default log formatting.
styleRestrictedElement( $content)
Helper method for styling restricted element.
LogEntryBase $entry
static newFromRow( $row)
Handy shortcut for constructing a formatter directly from database row.
canView( $field)
Check if a log item can be displayed.
bool $linkFlood
Whether to output user tool links.
setShowUserToolLinks( $value)
If set to true, will produce user tool links after the user name.
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
array $parsedParameters
getMessageParametersForTesting()
__construct(LogEntry $entry)
bool $plaintext
Set to true if we are constructing a message text that is going to be included in page history or sen...
getRestrictedElement( $message)
Helper method for displaying restricted element.
setContentLanguage(Language $contentLanguage)
formatParameterValue( $type, $value)
Formats parameters values dependent to their type.
getActionMessage()
Returns a sentence describing the log action.
const FOR_THIS_USER
getActionText()
Gets the log action, including username.
canViewLogType()
Check if a log item type can be displayed.
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
getPerformerElement()
Provides the name of the user who performed the log action.
setLinkRenderer(LinkRenderer $linkRenderer)
formatParameterValueForApi( $name, $type, $value)
Format a single parameter value for API output.
IContextSource $context
Context for logging.
int $audience
Constant for handling log_deleted.
formatParametersForApi()
Format parameters for API output.
getComment()
Gets the user provided comment.
getParametersForApi()
Get the array of parameters, converted from legacy format if necessary.
makePageLink(Title $title=null, $parameters=[], $html=null)
Helper to make a link to the page, taking the plaintext value in consideration.
getMessageKey()
Returns a key to be used for formatting the action sentence.
setUserEditTracker(UserEditTracker $userEditTracker)
makeUserLink(UserIdentity $user, $toolFlags=0)
setCommentFormatter(CommentFormatter $commentFormatter)
setAudience( $audience)
Set the visibility restrictions for displaying content.
getIRCActionText()
Even uglier hack to maintain backwards compatibility with IRC bots (T36508).
setContext(IContextSource $context)
Replace the default context.
getIRCActionComment()
Even uglier hack to maintain backwards compatibility with IRC bots (T36508).
getPlainActionText()
Ugly hack to produce plaintext version of the message.
extractParameters()
Extracts the optional extra parameters for use in action messages.
getMessageParameters()
Formats parameters intended for action message from array of all parameters.
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:56
Class that generates HTML for internal links.
Some internal bits split of from Skin.php.
Definition Linker.php:63
A class containing constants representing the names of configuration variables.
Service locator for MediaWiki core services.
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:150
Parent class for all special pages.
Represents a title within MediaWiki.
Definition Title.php:78
Track info about user edit counts and timings.
internal since 1.36
Definition User.php:93
An individual log entry.
Definition LogEntry.php:35
Interface for objects which can provide a MediaWiki context on request.
Represents the target of a wiki link.
Interface for objects representing user identity.
getId( $wikiId=self::LOCAL)