MediaWiki master
LogFormatter.php
Go to the documentation of this file.
1<?php
46
60 // Audience options for viewing usernames, comments, and actions
61 public const FOR_PUBLIC = 1;
62 public const FOR_THIS_USER = 2;
63
64 // Static->
65
72 public static function newFromEntry( LogEntry $entry ) {
73 wfDeprecated( __METHOD__, '1.42' );
74 return MediaWikiServices::getInstance()->getLogFormatterFactory()->newFromEntry( $entry );
75 }
76
85 public static function newFromRow( $row ) {
86 wfDeprecated( __METHOD__, '1.42' );
87 return self::newFromEntry( DatabaseLogEntry::newFromRow( $row ) );
88 }
89
90 // Nonstatic->
91
93 protected $entry;
94
96 protected $audience = self::FOR_PUBLIC;
97
99 public $context;
100
102 protected $linkFlood = false;
103
111 protected $plaintext = false;
112
114 protected $irctext = false;
115
117 private $linkRenderer;
118
120 private $contentLanguage;
121
123 private $commentFormatter;
124
126 private $userEditTracker;
127
133
139 public function __construct( LogEntry $entry ) {
140 $this->entry = $entry;
141 $this->context = RequestContext::getMain();
142 }
143
148 public function setContext( IContextSource $context ) {
149 $this->context = $context;
150 }
151
156 public function setLinkRenderer( LinkRenderer $linkRenderer ) {
157 $this->linkRenderer = $linkRenderer;
158 }
159
164 public function getLinkRenderer() {
165 if ( $this->linkRenderer !== null ) {
166 return $this->linkRenderer;
167 } else {
168 wfDeprecated( static::class . " without all required services", '1.42' );
169 return MediaWikiServices::getInstance()->getLinkRenderer();
170 }
171 }
172
178 final public function setContentLanguage( Language $contentLanguage ) {
179 $this->contentLanguage = $contentLanguage;
180 }
181
186 final public function getContentLanguage(): Language {
187 if ( $this->contentLanguage === null ) {
188 wfDeprecated( static::class . " without all required services", '1.42' );
189 $this->contentLanguage = MediaWikiServices::getInstance()->getContentLanguage();
190 }
191 return $this->contentLanguage;
192 }
193
199 final public function setCommentFormatter( CommentFormatter $commentFormatter ) {
200 $this->commentFormatter = $commentFormatter;
201 }
202
207 final public function getCommentFormatter(): CommentFormatter {
208 if ( $this->commentFormatter === null ) {
209 wfDeprecated( static::class . " without all required services", '1.42' );
210 $this->commentFormatter = MediaWikiServices::getInstance()->getCommentFormatter();
211 }
212 return $this->commentFormatter;
213 }
214
220 final public function setUserEditTracker( UserEditTracker $userEditTracker ) {
221 $this->userEditTracker = $userEditTracker;
222 }
223
228 final public function getUserEditTracker(): UserEditTracker {
229 if ( $this->userEditTracker === null ) {
230 wfDeprecated( static::class . " without all required services", '1.42' );
231 $this->userEditTracker = MediaWikiServices::getInstance()->getUserEditTracker();
232 }
233 return $this->userEditTracker;
234 }
235
242 public function setAudience( $audience ) {
243 $this->audience = ( $audience == self::FOR_THIS_USER )
244 ? self::FOR_THIS_USER
245 : self::FOR_PUBLIC;
246 }
247
252 public function canViewLogType() {
253 // If the user doesn't have the right permission to view the specific
254 // log type, return false
255 $logRestrictions = $this->context->getConfig()->get( MainConfigNames::LogRestrictions );
256 $type = $this->entry->getType();
257 return !isset( $logRestrictions[$type] )
258 || $this->context->getAuthority()->isAllowed( $logRestrictions[$type] );
259 }
260
266 protected function canView( $field ) {
267 if ( $this->audience == self::FOR_THIS_USER ) {
268 return LogEventsList::userCanBitfield(
269 $this->entry->getDeleted(), $field, $this->context->getAuthority() ) &&
270 self::canViewLogType();
271 } else {
272 return !$this->entry->isDeleted( $field ) && self::canViewLogType();
273 }
274 }
275
282 public function setShowUserToolLinks( $value ) {
283 $this->linkFlood = $value;
284 }
285
294 public function getPlainActionText() {
295 $this->plaintext = true;
296 $text = $this->getActionText();
297 $this->plaintext = false;
298
299 return $text;
300 }
301
308 public function getIRCActionComment() {
309 $actionComment = $this->getIRCActionText();
310 $comment = $this->entry->getComment();
311
312 if ( $comment != '' ) {
313 if ( $actionComment == '' ) {
314 $actionComment = $comment;
315 } else {
316 $actionComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
317 }
318 }
319
320 return $actionComment;
321 }
322
330 public function getIRCActionText() {
331 $this->plaintext = true;
332 $this->irctext = true;
333
334 $entry = $this->entry;
335 $parameters = $entry->getParameters();
336 // @see LogPage::actionText()
337 // Text of title the action is aimed at.
338 $target = $entry->getTarget()->getPrefixedText();
339 $text = null;
340 $contLang = $this->getContentLanguage();
341 switch ( $entry->getType() ) {
342 case 'move':
343 switch ( $entry->getSubtype() ) {
344 case 'move':
345 $movesource = $parameters['4::target'];
346 $text = wfMessage( '1movedto2' )
347 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
348 break;
349 case 'move_redir':
350 $movesource = $parameters['4::target'];
351 $text = wfMessage( '1movedto2_redir' )
352 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
353 break;
354 case 'move-noredirect':
355 break;
356 case 'move_redir-noredirect':
357 break;
358 }
359 break;
360
361 case 'delete':
362 switch ( $entry->getSubtype() ) {
363 case 'delete':
364 $text = wfMessage( 'deletedarticle' )
365 ->rawParams( $target )->inContentLanguage()->escaped();
366 break;
367 case 'restore':
368 $text = wfMessage( 'undeletedarticle' )
369 ->rawParams( $target )->inContentLanguage()->escaped();
370 break;
371 }
372 break;
373
374 case 'patrol':
375 // https://github.com/wikimedia/mediawiki/commit/1a05f8faf78675dc85984f27f355b8825b43efff
376 // Create a diff link to the patrolled revision
377 if ( $entry->getSubtype() === 'patrol' ) {
378 $diffLink = htmlspecialchars(
379 wfMessage( 'patrol-log-diff', $parameters['4::curid'] )
380 ->inContentLanguage()->text() );
381 $text = wfMessage( 'patrol-log-line', $diffLink, "[[$target]]", "" )
382 ->inContentLanguage()->text();
383 } else {
384 // broken??
385 }
386 break;
387
388 case 'protect':
389 switch ( $entry->getSubtype() ) {
390 case 'protect':
391 $text = wfMessage( 'protectedarticle' )
392 ->rawParams( $target . ' ' . $parameters['4::description'] )
393 ->inContentLanguage()
394 ->escaped();
395 break;
396 case 'unprotect':
397 $text = wfMessage( 'unprotectedarticle' )
398 ->rawParams( $target )->inContentLanguage()->escaped();
399 break;
400 case 'modify':
401 $text = wfMessage( 'modifiedarticleprotection' )
402 ->rawParams( $target . ' ' . $parameters['4::description'] )
403 ->inContentLanguage()
404 ->escaped();
405 break;
406 case 'move_prot':
407 $text = wfMessage( 'movedarticleprotection' )
408 ->rawParams( $target, $parameters['4::oldtitle'] )->inContentLanguage()->escaped();
409 break;
410 }
411 break;
412
413 case 'newusers':
414 switch ( $entry->getSubtype() ) {
415 case 'newusers':
416 case 'create':
417 $text = wfMessage( 'newuserlog-create-entry' )
418 ->inContentLanguage()->escaped();
419 break;
420 case 'create2':
421 case 'byemail':
422 $text = wfMessage( 'newuserlog-create2-entry' )
423 ->rawParams( $target )->inContentLanguage()->escaped();
424 break;
425 case 'autocreate':
426 $text = wfMessage( 'newuserlog-autocreate-entry' )
427 ->inContentLanguage()->escaped();
428 break;
429 }
430 break;
431
432 case 'upload':
433 switch ( $entry->getSubtype() ) {
434 case 'upload':
435 $text = wfMessage( 'uploadedimage' )
436 ->rawParams( $target )->inContentLanguage()->escaped();
437 break;
438 case 'overwrite':
439 case 'revert':
440 $text = wfMessage( 'overwroteimage' )
441 ->rawParams( $target )->inContentLanguage()->escaped();
442 break;
443 }
444 break;
445
446 case 'rights':
447 if ( count( $parameters['4::oldgroups'] ) ) {
448 $oldgroups = implode( ', ', $parameters['4::oldgroups'] );
449 } else {
450 $oldgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
451 }
452 if ( count( $parameters['5::newgroups'] ) ) {
453 $newgroups = implode( ', ', $parameters['5::newgroups'] );
454 } else {
455 $newgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
456 }
457 switch ( $entry->getSubtype() ) {
458 case 'rights':
459 $text = wfMessage( 'rightslogentry' )
460 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
461 break;
462 case 'autopromote':
463 $text = wfMessage( 'rightslogentry-autopromote' )
464 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
465 break;
466 }
467 break;
468
469 case 'merge':
470 $text = wfMessage( 'pagemerge-logentry' )
471 ->rawParams( $target, $parameters['4::dest'], $parameters['5::mergepoint'] )
472 ->inContentLanguage()->escaped();
473 break;
474
475 case 'block':
476 switch ( $entry->getSubtype() ) {
477 case 'block':
478 // Keep compatibility with extensions by checking for
479 // new key (5::duration/6::flags) or old key (0/optional 1)
480 if ( $entry->isLegacy() ) {
481 $rawDuration = $parameters[0];
482 $rawFlags = $parameters[1] ?? '';
483 } else {
484 $rawDuration = $parameters['5::duration'];
485 $rawFlags = $parameters['6::flags'];
486 }
487 $duration = $contLang->translateBlockExpiry(
488 $rawDuration,
489 null,
490 (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
491 );
492 $flags = BlockLogFormatter::formatBlockFlags( $rawFlags, $contLang );
493 $text = wfMessage( 'blocklogentry' )
494 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
495 break;
496 case 'unblock':
497 $text = wfMessage( 'unblocklogentry' )
498 ->rawParams( $target )->inContentLanguage()->escaped();
499 break;
500 case 'reblock':
501 $duration = $contLang->translateBlockExpiry(
502 $parameters['5::duration'],
503 null,
504 (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
505 );
506 $flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'],
507 $contLang );
508 $text = wfMessage( 'reblock-logentry' )
509 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
510 break;
511 }
512 break;
513
514 case 'import':
515 switch ( $entry->getSubtype() ) {
516 case 'upload':
517 $text = wfMessage( 'import-logentry-upload' )
518 ->rawParams( $target )->inContentLanguage()->escaped();
519 break;
520 case 'interwiki':
521 $text = wfMessage( 'import-logentry-interwiki' )
522 ->rawParams( $target )->inContentLanguage()->escaped();
523 break;
524 }
525 break;
526 // case 'suppress' --private log -- aaron (so we know who to blame in a few years :-D)
527 // default:
528 }
529
530 $this->plaintext = false;
531 $this->irctext = false;
532
533 return $text ?? $this->getPlainActionText();
534 }
535
543 public function getActionText() {
544 if ( $this->canView( LogPage::DELETED_ACTION ) ) {
545 $element = $this->getActionMessage();
546 if ( $element instanceof Message ) {
547 $element = $this->plaintext ? $element->text() : $element->escaped();
548 }
549 if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
550 $element = $this->styleRestrictedElement( $element );
551 }
552 } else {
553 $sep = $this->msg( 'word-separator' );
554 $sep = $this->plaintext ? $sep->text() : $sep->escaped();
555 $performer = $this->getPerformerElement();
556 $element = $performer . $sep . $this->getRestrictedElement( 'rev-deleted-event' );
557 }
558
559 return $element;
560 }
561
568 protected function getActionMessage() {
569 $message = $this->msg( $this->getMessageKey() );
570 $message->params( $this->getMessageParameters() );
571
572 return $message;
573 }
574
583 protected function getMessageKey() {
584 $type = $this->entry->getType();
585 $subtype = $this->entry->getSubtype();
586
587 return "logentry-$type-$subtype";
588 }
589
596 public function getActionLinks() {
597 return '';
598 }
599
606 protected function extractParameters() {
607 $entry = $this->entry;
608 $params = [];
609
610 if ( $entry->isLegacy() ) {
611 foreach ( $entry->getParameters() as $index => $value ) {
612 $params[$index + 3] = $value;
613 }
614 }
615
616 // Filter out parameters which are not in format #:foo
617 foreach ( $entry->getParameters() as $key => $value ) {
618 if ( strpos( $key, ':' ) === false ) {
619 continue;
620 }
621 [ $index, $type, ] = explode( ':', $key, 3 );
622 if ( ctype_digit( $index ) ) {
623 $params[(int)$index - 1] = $this->formatParameterValue( $type, $value );
624 }
625 }
626
627 /* Message class doesn't like non consecutive numbering.
628 * Fill in missing indexes with empty strings to avoid
629 * incorrect renumbering.
630 */
631 if ( count( $params ) ) {
632 $max = max( array_keys( $params ) );
633 // index 0 to 2 are added in getMessageParameters
634 for ( $i = 3; $i < $max; $i++ ) {
635 if ( !isset( $params[$i] ) ) {
636 $params[$i] = '';
637 }
638 }
639 }
640
641 return $params;
642 }
643
661 protected function getMessageParameters() {
662 if ( isset( $this->parsedParameters ) ) {
663 return $this->parsedParameters;
664 }
665
666 $entry = $this->entry;
667 $params = $this->extractParameters();
668 $params[0] = Message::rawParam( $this->getPerformerElement() );
669 $params[1] = $this->canView( LogPage::DELETED_USER ) ? $entry->getPerformerIdentity()->getName() : '';
670 $params[2] = Message::rawParam( $this->makePageLink( $entry->getTarget() ) );
671
672 // Bad things happens if the numbers are not in correct order
673 ksort( $params );
674
675 $this->parsedParameters = $params;
676 return $this->parsedParameters;
677 }
678
705 protected function formatParameterValue( $type, $value ) {
706 $saveLinkFlood = $this->linkFlood;
707
708 switch ( strtolower( trim( $type ) ) ) {
709 case 'raw':
710 $value = Message::rawParam( $value );
711 break;
712 case 'list':
713 $value = $this->context->getLanguage()->commaList( $value );
714 break;
715 case 'msg':
716 $value = $this->msg( $value )->text();
717 break;
718 case 'msg-content':
719 $value = $this->msg( $value )->inContentLanguage()->text();
720 break;
721 case 'number':
722 $value = Message::numParam( $value );
723 break;
724 case 'user':
725 $user = User::newFromName( $value );
726 $value = $user->getName();
727 break;
728 case 'user-link':
729 $this->setShowUserToolLinks( false );
730
731 $user = User::newFromName( $value );
732
733 if ( !$user ) {
734 $value = $this->msg( 'empty-username' )->text();
735 } else {
736 $value = Message::rawParam( $this->makeUserLink( $user ) );
737 $this->setShowUserToolLinks( $saveLinkFlood );
738 }
739 break;
740 case 'title':
741 $title = Title::newFromText( $value );
742 $value = $title->getPrefixedText();
743 break;
744 case 'title-link':
745 $title = Title::newFromText( $value );
746 $value = Message::rawParam( $this->makePageLink( $title ) );
747 break;
748 case 'plain':
749 // Plain text, nothing to do
750 default:
751 // Catch other types and use the old behavior (return as-is)
752 }
753
754 return $value;
755 }
756
767 protected function makePageLink( ?Title $title = null, $parameters = [], $html = null ) {
768 if ( !$title instanceof Title ) {
769 $msg = $this->msg( 'invalidtitle' )->text();
770 if ( $this->plaintext ) {
771 return $msg;
772 } else {
773 return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ], $msg );
774 }
775 }
776
777 if ( $this->plaintext ) {
778 $link = '[[' . $title->getPrefixedText() . ']]';
779 } else {
780 $html = $html !== null ? new HtmlArmor( $html ) : $html;
781 $link = $this->getLinkRenderer()->makeLink( $title, $html, [], $parameters );
782 }
783
784 return $link;
785 }
786
793 public function getPerformerElement() {
794 if ( $this->canView( LogPage::DELETED_USER ) ) {
795 $performerIdentity = $this->entry->getPerformerIdentity();
796 $element = $this->makeUserLink( $performerIdentity );
797 if ( $this->entry->isDeleted( LogPage::DELETED_USER ) ) {
798 $element = $this->styleRestrictedElement( $element );
799 }
800 } else {
801 $element = $this->getRestrictedElement( 'rev-deleted-user' );
802 }
803
804 return $element;
805 }
806
812 public function getComment() {
813 if ( $this->canView( LogPage::DELETED_COMMENT ) ) {
814 $comment = $this->getCommentFormatter()
815 ->formatBlock( $this->entry->getComment() );
816 // No hard coded spaces thanx
817 $element = ltrim( $comment );
818 if ( $this->entry->isDeleted( LogPage::DELETED_COMMENT ) ) {
819 $element = $this->styleRestrictedElement( $element );
820 }
821 } else {
822 $element = $this->getRestrictedElement( 'rev-deleted-comment' );
823 }
824
825 return $element;
826 }
827
834 protected function getRestrictedElement( $message ) {
835 if ( $this->plaintext ) {
836 return $this->msg( $message )->text();
837 }
838
839 return $this->styleRestrictedElement( $this->msg( $message )->escaped() );
840 }
841
847 protected function styleRestrictedElement( $content ) {
848 if ( $this->plaintext ) {
849 return $content;
850 }
851 $attribs = [ 'class' => [ 'history-deleted' ] ];
852 if ( $this->entry->isDeleted( LogPage::DELETED_RESTRICTED ) ) {
853 $attribs['class'][] = 'mw-history-suppressed';
854 }
855
856 return Html::rawElement( 'span', $attribs, $content );
857 }
858
867 protected function msg( $key, ...$params ) {
868 return $this->context->msg( $key, ...$params );
869 }
870
877 protected function makeUserLink( UserIdentity $user, $toolFlags = 0 ) {
878 if ( $this->plaintext ) {
879 $element = $user->getName();
880 } else {
881 $element = Linker::userLink(
882 $user->getId(),
883 $user->getName()
884 );
885 if ( $this->linkFlood ) {
886 $editCount = $this->getUserEditTracker()->getUserEditCount( $user );
887
888 $element .= Linker::userToolLinks(
889 $user->getId(),
890 $user->getName(),
891 true, // redContribsWhenNoEdits
892 $toolFlags,
893 $editCount,
894 // do not render parentheses in the HTML markup (CSS will provide)
895 false
896 );
897 }
898 }
899
900 return $element;
901 }
902
907 public function getPreloadTitles() {
908 return [];
909 }
910
915 // This function was added because getMessageParameters() is
916 // protected and a change from protected to public caused
917 // problems with extensions
918 return $this->getMessageParameters();
919 }
920
927 protected function getParametersForApi() {
928 return $this->entry->getParameters();
929 }
930
946 public function formatParametersForApi() {
947 $logParams = [];
948 foreach ( $this->getParametersForApi() as $key => $value ) {
949 $vals = explode( ':', $key, 3 );
950 if ( count( $vals ) !== 3 ) {
951 if ( $value instanceof __PHP_Incomplete_Class ) {
952 wfLogWarning( 'Log entry of type ' . $this->entry->getFullType() .
953 ' contains unrecoverable extra parameters.' );
954 continue;
955 }
956 $logParams[$key] = $value;
957 continue;
958 }
959 $logParams += $this->formatParameterValueForApi( $vals[2], $vals[1], $value );
960 }
961 ApiResult::setIndexedTagName( $logParams, 'param' );
962 ApiResult::setArrayType( $logParams, 'assoc' );
963
964 return $logParams;
965 }
966
976 protected function formatParameterValueForApi( $name, $type, $value ) {
977 $type = strtolower( trim( $type ) );
978 switch ( $type ) {
979 case 'bool':
980 $value = (bool)$value;
981 break;
982
983 case 'number':
984 if ( is_int( $value ) || ctype_digit( (string)$value ) ) {
985 $value = (int)$value;
986 } else {
987 $value = (float)$value;
988 }
989 break;
990
991 case 'array':
992 case 'assoc':
993 case 'kvp':
994 if ( is_array( $value ) ) {
995 ApiResult::setArrayType( $value, $type );
996 }
997 break;
998
999 case 'timestamp':
1000 $value = wfTimestamp( TS_ISO_8601, $value );
1001 break;
1002
1003 case 'msg':
1004 case 'msg-content':
1005 $msg = $this->msg( $value );
1006 if ( $type === 'msg-content' ) {
1007 $msg->inContentLanguage();
1008 }
1009 $value = [];
1010 $value["{$name}_key"] = $msg->getKey();
1011 if ( $msg->getParams() ) {
1012 $value["{$name}_params"] = $msg->getParams();
1013 }
1014 $value["{$name}_text"] = $msg->text();
1015 return $value;
1016
1017 case 'title':
1018 case 'title-link':
1019 $title = Title::newFromText( $value );
1020 if ( !$title ) {
1021 $title = SpecialPage::getTitleFor( 'Badtitle', $value );
1022 }
1023 $value = [];
1024 ApiQueryBase::addTitleInfo( $value, $title, "{$name}_" );
1025 return $value;
1026
1027 case 'user':
1028 case 'user-link':
1029 $user = User::newFromName( $value );
1030 if ( $user ) {
1031 $value = $user->getName();
1032 }
1033 break;
1034
1035 default:
1036 // do nothing
1037 break;
1038 }
1039
1040 return [ $name => $value ];
1041 }
1042}
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.
makePageLink(?Title $title=null, $parameters=[], $html=null)
Helper to make a link to the page, taking the plaintext value in consideration.
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.
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 a base class for all Query modules.
This class represents the result of the API operations.
Definition ApiResult.php:43
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
Base class for language-specific code.
Definition Language.php:80
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:155
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
Value object representing a message parameter that consists of a list of values.
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)