MediaWiki master
LogFormatter.php
Go to the documentation of this file.
1<?php
40
54 // Audience options for viewing usernames, comments, and actions
55 public const FOR_PUBLIC = 1;
56 public const FOR_THIS_USER = 2;
57
58 // Static->
59
66 public static function newFromEntry( LogEntry $entry ) {
67 return MediaWikiServices::getInstance()->getLogFormatterFactory()->newFromEntry( $entry );
68 }
69
78 public static function newFromRow( $row ) {
79 return self::newFromEntry( DatabaseLogEntry::newFromRow( $row ) );
80 }
81
82 // Nonstatic->
83
85 protected $entry;
86
88 protected $audience = self::FOR_PUBLIC;
89
91 public $context;
92
94 protected $linkFlood = false;
95
103 protected $plaintext = false;
104
106 protected $irctext = false;
107
109 private $linkRenderer;
110
112 private $contentLanguage;
113
115 private $commentFormatter;
116
118 private $userEditTracker;
119
125
131 public function __construct( LogEntry $entry ) {
132 $this->entry = $entry;
133 $this->context = RequestContext::getMain();
134 }
135
140 public function setContext( IContextSource $context ) {
141 $this->context = $context;
142 }
143
148 public function setLinkRenderer( LinkRenderer $linkRenderer ) {
149 $this->linkRenderer = $linkRenderer;
150 }
151
156 public function getLinkRenderer() {
157 if ( $this->linkRenderer !== null ) {
158 return $this->linkRenderer;
159 } else {
160 wfDeprecated( static::class . " without all required services", '1.42' );
161 return MediaWikiServices::getInstance()->getLinkRenderer();
162 }
163 }
164
170 final public function setContentLanguage( Language $contentLanguage ) {
171 $this->contentLanguage = $contentLanguage;
172 }
173
178 final public function getContentLanguage(): Language {
179 if ( $this->contentLanguage === null ) {
180 wfDeprecated( static::class . " without all required services", '1.42' );
181 $this->contentLanguage = MediaWikiServices::getInstance()->getContentLanguage();
182 }
183 return $this->contentLanguage;
184 }
185
191 final public function setCommentFormatter( CommentFormatter $commentFormatter ) {
192 $this->commentFormatter = $commentFormatter;
193 }
194
199 final public function getCommentFormatter(): CommentFormatter {
200 if ( $this->commentFormatter === null ) {
201 wfDeprecated( static::class . " without all required services", '1.42' );
202 $this->commentFormatter = MediaWikiServices::getInstance()->getCommentFormatter();
203 }
204 return $this->commentFormatter;
205 }
206
212 final public function setUserEditTracker( UserEditTracker $userEditTracker ) {
213 $this->userEditTracker = $userEditTracker;
214 }
215
220 final public function getUserEditTracker(): UserEditTracker {
221 if ( $this->userEditTracker === null ) {
222 wfDeprecated( static::class . " without all required services", '1.42' );
223 $this->userEditTracker = MediaWikiServices::getInstance()->getUserEditTracker();
224 }
225 return $this->userEditTracker;
226 }
227
234 public function setAudience( $audience ) {
235 $this->audience = ( $audience == self::FOR_THIS_USER )
236 ? self::FOR_THIS_USER
237 : self::FOR_PUBLIC;
238 }
239
244 public function canViewLogType() {
245 // If the user doesn't have the right permission to view the specific
246 // log type, return false
247 $logRestrictions = $this->context->getConfig()->get( MainConfigNames::LogRestrictions );
248 $type = $this->entry->getType();
249 return !isset( $logRestrictions[$type] )
250 || $this->context->getAuthority()->isAllowed( $logRestrictions[$type] );
251 }
252
258 protected function canView( $field ) {
259 if ( $this->audience == self::FOR_THIS_USER ) {
260 return LogEventsList::userCanBitfield(
261 $this->entry->getDeleted(), $field, $this->context->getAuthority() ) &&
262 self::canViewLogType();
263 } else {
264 return !$this->entry->isDeleted( $field ) && self::canViewLogType();
265 }
266 }
267
274 public function setShowUserToolLinks( $value ) {
275 $this->linkFlood = $value;
276 }
277
286 public function getPlainActionText() {
287 $this->plaintext = true;
288 $text = $this->getActionText();
289 $this->plaintext = false;
290
291 return $text;
292 }
293
300 public function getIRCActionComment() {
301 $actionComment = $this->getIRCActionText();
302 $comment = $this->entry->getComment();
303
304 if ( $comment != '' ) {
305 if ( $actionComment == '' ) {
306 $actionComment = $comment;
307 } else {
308 $actionComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
309 }
310 }
311
312 return $actionComment;
313 }
314
322 public function getIRCActionText() {
323 $this->plaintext = true;
324 $this->irctext = true;
325
326 $entry = $this->entry;
327 $parameters = $entry->getParameters();
328 // @see LogPage::actionText()
329 // Text of title the action is aimed at.
330 $target = $entry->getTarget()->getPrefixedText();
331 $text = null;
332 $contLang = $this->getContentLanguage();
333 switch ( $entry->getType() ) {
334 case 'move':
335 switch ( $entry->getSubtype() ) {
336 case 'move':
337 $movesource = $parameters['4::target'];
338 $text = wfMessage( '1movedto2' )
339 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
340 break;
341 case 'move_redir':
342 $movesource = $parameters['4::target'];
343 $text = wfMessage( '1movedto2_redir' )
344 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
345 break;
346 case 'move-noredirect':
347 break;
348 case 'move_redir-noredirect':
349 break;
350 }
351 break;
352
353 case 'delete':
354 switch ( $entry->getSubtype() ) {
355 case 'delete':
356 $text = wfMessage( 'deletedarticle' )
357 ->rawParams( $target )->inContentLanguage()->escaped();
358 break;
359 case 'restore':
360 $text = wfMessage( 'undeletedarticle' )
361 ->rawParams( $target )->inContentLanguage()->escaped();
362 break;
363 }
364 break;
365
366 case 'patrol':
367 // https://github.com/wikimedia/mediawiki/commit/1a05f8faf78675dc85984f27f355b8825b43efff
368 // Create a diff link to the patrolled revision
369 if ( $entry->getSubtype() === 'patrol' ) {
370 $diffLink = htmlspecialchars(
371 wfMessage( 'patrol-log-diff', $parameters['4::curid'] )
372 ->inContentLanguage()->text() );
373 $text = wfMessage( 'patrol-log-line', $diffLink, "[[$target]]", "" )
374 ->inContentLanguage()->text();
375 } else {
376 // broken??
377 }
378 break;
379
380 case 'protect':
381 switch ( $entry->getSubtype() ) {
382 case 'protect':
383 $text = wfMessage( 'protectedarticle' )
384 ->rawParams( $target . ' ' . $parameters['4::description'] )
385 ->inContentLanguage()
386 ->escaped();
387 break;
388 case 'unprotect':
389 $text = wfMessage( 'unprotectedarticle' )
390 ->rawParams( $target )->inContentLanguage()->escaped();
391 break;
392 case 'modify':
393 $text = wfMessage( 'modifiedarticleprotection' )
394 ->rawParams( $target . ' ' . $parameters['4::description'] )
395 ->inContentLanguage()
396 ->escaped();
397 break;
398 case 'move_prot':
399 $text = wfMessage( 'movedarticleprotection' )
400 ->rawParams( $target, $parameters['4::oldtitle'] )->inContentLanguage()->escaped();
401 break;
402 }
403 break;
404
405 case 'newusers':
406 switch ( $entry->getSubtype() ) {
407 case 'newusers':
408 case 'create':
409 $text = wfMessage( 'newuserlog-create-entry' )
410 ->inContentLanguage()->escaped();
411 break;
412 case 'create2':
413 case 'byemail':
414 $text = wfMessage( 'newuserlog-create2-entry' )
415 ->rawParams( $target )->inContentLanguage()->escaped();
416 break;
417 case 'autocreate':
418 $text = wfMessage( 'newuserlog-autocreate-entry' )
419 ->inContentLanguage()->escaped();
420 break;
421 }
422 break;
423
424 case 'upload':
425 switch ( $entry->getSubtype() ) {
426 case 'upload':
427 $text = wfMessage( 'uploadedimage' )
428 ->rawParams( $target )->inContentLanguage()->escaped();
429 break;
430 case 'overwrite':
431 case 'revert':
432 $text = wfMessage( 'overwroteimage' )
433 ->rawParams( $target )->inContentLanguage()->escaped();
434 break;
435 }
436 break;
437
438 case 'rights':
439 if ( count( $parameters['4::oldgroups'] ) ) {
440 $oldgroups = implode( ', ', $parameters['4::oldgroups'] );
441 } else {
442 $oldgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
443 }
444 if ( count( $parameters['5::newgroups'] ) ) {
445 $newgroups = implode( ', ', $parameters['5::newgroups'] );
446 } else {
447 $newgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
448 }
449 switch ( $entry->getSubtype() ) {
450 case 'rights':
451 $text = wfMessage( 'rightslogentry' )
452 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
453 break;
454 case 'autopromote':
455 $text = wfMessage( 'rightslogentry-autopromote' )
456 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
457 break;
458 }
459 break;
460
461 case 'merge':
462 $text = wfMessage( 'pagemerge-logentry' )
463 ->rawParams( $target, $parameters['4::dest'], $parameters['5::mergepoint'] )
464 ->inContentLanguage()->escaped();
465 break;
466
467 case 'block':
468 switch ( $entry->getSubtype() ) {
469 case 'block':
470 // Keep compatibility with extensions by checking for
471 // new key (5::duration/6::flags) or old key (0/optional 1)
472 if ( $entry->isLegacy() ) {
473 $rawDuration = $parameters[0];
474 $rawFlags = $parameters[1] ?? '';
475 } else {
476 $rawDuration = $parameters['5::duration'];
477 $rawFlags = $parameters['6::flags'];
478 }
479 $duration = $contLang->translateBlockExpiry(
480 $rawDuration,
481 null,
482 (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
483 );
484 $flags = BlockLogFormatter::formatBlockFlags( $rawFlags, $contLang );
485 $text = wfMessage( 'blocklogentry' )
486 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
487 break;
488 case 'unblock':
489 $text = wfMessage( 'unblocklogentry' )
490 ->rawParams( $target )->inContentLanguage()->escaped();
491 break;
492 case 'reblock':
493 $duration = $contLang->translateBlockExpiry(
494 $parameters['5::duration'],
495 null,
496 (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
497 );
498 $flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'],
499 $contLang );
500 $text = wfMessage( 'reblock-logentry' )
501 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
502 break;
503 }
504 break;
505
506 case 'import':
507 switch ( $entry->getSubtype() ) {
508 case 'upload':
509 $text = wfMessage( 'import-logentry-upload' )
510 ->rawParams( $target )->inContentLanguage()->escaped();
511 break;
512 case 'interwiki':
513 $text = wfMessage( 'import-logentry-interwiki' )
514 ->rawParams( $target )->inContentLanguage()->escaped();
515 break;
516 }
517 break;
518 // case 'suppress' --private log -- aaron (so we know who to blame in a few years :-D)
519 // default:
520 }
521
522 $this->plaintext = false;
523 $this->irctext = false;
524
525 return $text ?? $this->getPlainActionText();
526 }
527
535 public function getActionText() {
536 if ( $this->canView( LogPage::DELETED_ACTION ) ) {
537 $element = $this->getActionMessage();
538 if ( $element instanceof Message ) {
539 $element = $this->plaintext ? $element->text() : $element->escaped();
540 }
541 if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
542 $element = $this->styleRestrictedElement( $element );
543 }
544 } else {
545 $sep = $this->msg( 'word-separator' );
546 $sep = $this->plaintext ? $sep->text() : $sep->escaped();
547 $performer = $this->getPerformerElement();
548 $element = $performer . $sep . $this->getRestrictedElement( 'rev-deleted-event' );
549 }
550
551 return $element;
552 }
553
560 protected function getActionMessage() {
561 $message = $this->msg( $this->getMessageKey() );
562 $message->params( $this->getMessageParameters() );
563
564 return $message;
565 }
566
575 protected function getMessageKey() {
576 $type = $this->entry->getType();
577 $subtype = $this->entry->getSubtype();
578
579 return "logentry-$type-$subtype";
580 }
581
588 public function getActionLinks() {
589 return '';
590 }
591
598 protected function extractParameters() {
599 $entry = $this->entry;
600 $params = [];
601
602 if ( $entry->isLegacy() ) {
603 foreach ( $entry->getParameters() as $index => $value ) {
604 $params[$index + 3] = $value;
605 }
606 }
607
608 // Filter out parameters which are not in format #:foo
609 foreach ( $entry->getParameters() as $key => $value ) {
610 if ( strpos( $key, ':' ) === false ) {
611 continue;
612 }
613 [ $index, $type, ] = explode( ':', $key, 3 );
614 if ( ctype_digit( $index ) ) {
615 $params[(int)$index - 1] = $this->formatParameterValue( $type, $value );
616 }
617 }
618
619 /* Message class doesn't like non consecutive numbering.
620 * Fill in missing indexes with empty strings to avoid
621 * incorrect renumbering.
622 */
623 if ( count( $params ) ) {
624 $max = max( array_keys( $params ) );
625 // index 0 to 2 are added in getMessageParameters
626 for ( $i = 3; $i < $max; $i++ ) {
627 if ( !isset( $params[$i] ) ) {
628 $params[$i] = '';
629 }
630 }
631 }
632
633 return $params;
634 }
635
653 protected function getMessageParameters() {
654 if ( isset( $this->parsedParameters ) ) {
655 return $this->parsedParameters;
656 }
657
658 $entry = $this->entry;
659 $params = $this->extractParameters();
660 $params[0] = Message::rawParam( $this->getPerformerElement() );
661 $params[1] = $this->canView( LogPage::DELETED_USER ) ? $entry->getPerformerIdentity()->getName() : '';
662 $params[2] = Message::rawParam( $this->makePageLink( $entry->getTarget() ) );
663
664 // Bad things happens if the numbers are not in correct order
665 ksort( $params );
666
667 $this->parsedParameters = $params;
668 return $this->parsedParameters;
669 }
670
697 protected function formatParameterValue( $type, $value ) {
698 $saveLinkFlood = $this->linkFlood;
699
700 switch ( strtolower( trim( $type ) ) ) {
701 case 'raw':
702 $value = Message::rawParam( $value );
703 break;
704 case 'list':
705 $value = $this->context->getLanguage()->commaList( $value );
706 break;
707 case 'msg':
708 $value = $this->msg( $value )->text();
709 break;
710 case 'msg-content':
711 $value = $this->msg( $value )->inContentLanguage()->text();
712 break;
713 case 'number':
714 $value = Message::numParam( $value );
715 break;
716 case 'user':
717 $user = User::newFromName( $value );
718 $value = $user->getName();
719 break;
720 case 'user-link':
721 $this->setShowUserToolLinks( false );
722
723 $user = User::newFromName( $value );
724
725 if ( !$user ) {
726 $value = $this->msg( 'empty-username' )->text();
727 } else {
728 $value = Message::rawParam( $this->makeUserLink( $user ) );
729 $this->setShowUserToolLinks( $saveLinkFlood );
730 }
731 break;
732 case 'title':
733 $title = Title::newFromText( $value );
734 $value = $title->getPrefixedText();
735 break;
736 case 'title-link':
737 $title = Title::newFromText( $value );
738 $value = Message::rawParam( $this->makePageLink( $title ) );
739 break;
740 case 'plain':
741 // Plain text, nothing to do
742 default:
743 // Catch other types and use the old behavior (return as-is)
744 }
745
746 return $value;
747 }
748
759 protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
760 if ( !$title instanceof Title ) {
761 $msg = $this->msg( 'invalidtitle' )->text();
762 if ( $this->plaintext ) {
763 return $msg;
764 } else {
765 return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ], $msg );
766 }
767 }
768
769 if ( $this->plaintext ) {
770 $link = '[[' . $title->getPrefixedText() . ']]';
771 } else {
772 $html = $html !== null ? new HtmlArmor( $html ) : $html;
773 $link = $this->getLinkRenderer()->makeLink( $title, $html, [], $parameters );
774 }
775
776 return $link;
777 }
778
785 public function getPerformerElement() {
786 if ( $this->canView( LogPage::DELETED_USER ) ) {
787 $performerIdentity = $this->entry->getPerformerIdentity();
788 $element = $this->makeUserLink( $performerIdentity );
789 if ( $this->entry->isDeleted( LogPage::DELETED_USER ) ) {
790 $element = $this->styleRestrictedElement( $element );
791 }
792 } else {
793 $element = $this->getRestrictedElement( 'rev-deleted-user' );
794 }
795
796 return $element;
797 }
798
804 public function getComment() {
805 if ( $this->canView( LogPage::DELETED_COMMENT ) ) {
806 $comment = $this->getCommentFormatter()
807 ->formatBlock( $this->entry->getComment() );
808 // No hard coded spaces thanx
809 $element = ltrim( $comment );
810 if ( $this->entry->isDeleted( LogPage::DELETED_COMMENT ) ) {
811 $element = $this->styleRestrictedElement( $element );
812 }
813 } else {
814 $element = $this->getRestrictedElement( 'rev-deleted-comment' );
815 }
816
817 return $element;
818 }
819
826 protected function getRestrictedElement( $message ) {
827 if ( $this->plaintext ) {
828 return $this->msg( $message )->text();
829 }
830
831 return $this->styleRestrictedElement( $this->msg( $message )->escaped() );
832 }
833
839 protected function styleRestrictedElement( $content ) {
840 if ( $this->plaintext ) {
841 return $content;
842 }
843 $attribs = [ 'class' => [ 'history-deleted' ] ];
844 if ( $this->entry->isDeleted( LogPage::DELETED_RESTRICTED ) ) {
845 $attribs['class'][] = 'mw-history-suppressed';
846 }
847
848 return Html::rawElement( 'span', $attribs, $content );
849 }
850
857 protected function msg( $key, ...$params ) {
858 return $this->context->msg( $key, ...$params );
859 }
860
867 protected function makeUserLink( UserIdentity $user, $toolFlags = 0 ) {
868 if ( $this->plaintext ) {
869 $element = $user->getName();
870 } else {
871 $element = Linker::userLink(
872 $user->getId(),
873 $user->getName()
874 );
875 if ( $this->linkFlood ) {
876 $editCount = $this->getUserEditTracker()->getUserEditCount( $user );
877
878 $element .= Linker::userToolLinks(
879 $user->getId(),
880 $user->getName(),
881 true, // redContribsWhenNoEdits
882 $toolFlags,
883 $editCount,
884 // do not render parentheses in the HTML markup (CSS will provide)
885 false
886 );
887 }
888 }
889
890 return $element;
891 }
892
897 public function getPreloadTitles() {
898 return [];
899 }
900
905 // This function was added because getMessageParameters() is
906 // protected and a change from protected to public caused
907 // problems with extensions
908 return $this->getMessageParameters();
909 }
910
917 protected function getParametersForApi() {
918 return $this->entry->getParameters();
919 }
920
936 public function formatParametersForApi() {
937 $logParams = [];
938 foreach ( $this->getParametersForApi() as $key => $value ) {
939 $vals = explode( ':', $key, 3 );
940 if ( count( $vals ) !== 3 ) {
941 if ( $value instanceof __PHP_Incomplete_Class ) {
942 wfLogWarning( 'Log entry of type ' . $this->entry->getFullType() .
943 ' contains unrecoverable extra parameters.' );
944 continue;
945 }
946 $logParams[$key] = $value;
947 continue;
948 }
949 $logParams += $this->formatParameterValueForApi( $vals[2], $vals[1], $value );
950 }
951 ApiResult::setIndexedTagName( $logParams, 'param' );
952 ApiResult::setArrayType( $logParams, 'assoc' );
953
954 return $logParams;
955 }
956
966 protected function formatParameterValueForApi( $name, $type, $value ) {
967 $type = strtolower( trim( $type ) );
968 switch ( $type ) {
969 case 'bool':
970 $value = (bool)$value;
971 break;
972
973 case 'number':
974 if ( is_int( $value ) || ctype_digit( (string)$value ) ) {
975 $value = (int)$value;
976 } else {
977 $value = (float)$value;
978 }
979 break;
980
981 case 'array':
982 case 'assoc':
983 case 'kvp':
984 if ( is_array( $value ) ) {
985 ApiResult::setArrayType( $value, $type );
986 }
987 break;
988
989 case 'timestamp':
990 $value = wfTimestamp( TS_ISO_8601, $value );
991 break;
992
993 case 'msg':
994 case 'msg-content':
995 $msg = $this->msg( $value );
996 if ( $type === 'msg-content' ) {
997 $msg->inContentLanguage();
998 }
999 $value = [];
1000 $value["{$name}_key"] = $msg->getKey();
1001 if ( $msg->getParams() ) {
1002 $value["{$name}_params"] = $msg->getParams();
1003 }
1004 $value["{$name}_text"] = $msg->text();
1005 return $value;
1006
1007 case 'title':
1008 case 'title-link':
1009 $title = Title::newFromText( $value );
1010 if ( !$title ) {
1011 $title = SpecialPage::getTitleFor( 'Badtitle', $value );
1012 }
1013 $value = [];
1014 ApiQueryBase::addTitleInfo( $value, $title, "{$name}_" );
1015 return $value;
1016
1017 case 'user':
1018 case 'user-link':
1019 $user = User::newFromName( $value );
1020 if ( $user ) {
1021 $value = $user->getName();
1022 }
1023 break;
1024
1025 default:
1026 // do nothing
1027 break;
1028 }
1029
1030 return [ $name => $value ];
1031 }
1032}
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
Base class for language-specific code.
Definition Language.php:63
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:65
A class containing constants representing the names of configuration variables.
Service locator for MediaWiki core services.
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)