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