MediaWiki  master
LogFormatter.php
Go to the documentation of this file.
1 <?php
32 
45 class LogFormatter {
46  // Audience options for viewing usernames, comments, and actions
47  public const FOR_PUBLIC = 1;
48  public const FOR_THIS_USER = 2;
49 
50  // Static->
51 
57  public static function newFromEntry( LogEntry $entry ) {
58  $logActionsHandlers = MediaWikiServices::getInstance()->getMainConfig()
59  ->get( MainConfigNames::LogActionsHandlers );
60  $fulltype = $entry->getFullType();
61  $wildcard = $entry->getType() . '/*';
62  $handler = $logActionsHandlers[$fulltype] ?? $logActionsHandlers[$wildcard] ?? '';
63 
64  if ( $handler !== '' && is_string( $handler ) && class_exists( $handler ) ) {
65  return new $handler( $entry );
66  }
67 
68  return new LegacyLogFormatter( $entry );
69  }
70 
78  public static function newFromRow( $row ) {
80  }
81 
82  // Nonstatic->
83 
85  protected $entry;
86 
89 
91  public $context;
92 
94  protected $linkFlood = false;
95 
103  protected $plaintext = false;
104 
106  protected $irctext = false;
107 
111  private $linkRenderer;
112 
117  protected $parsedParameters;
118 
124  protected function __construct( LogEntry $entry ) {
125  $this->entry = $entry;
126  $this->context = RequestContext::getMain();
127  }
128 
133  public function setContext( IContextSource $context ) {
134  $this->context = $context;
135  }
136 
141  public function setLinkRenderer( LinkRenderer $linkRenderer ) {
142  $this->linkRenderer = $linkRenderer;
143  }
144 
149  public function getLinkRenderer() {
150  if ( $this->linkRenderer !== null ) {
151  return $this->linkRenderer;
152  } else {
153  return MediaWikiServices::getInstance()->getLinkRenderer();
154  }
155  }
156 
163  public function setAudience( $audience ) {
164  $this->audience = ( $audience == self::FOR_THIS_USER )
165  ? self::FOR_THIS_USER
166  : self::FOR_PUBLIC;
167  }
168 
173  public function canViewLogType() {
174  // If the user doesn't have the right permission to view the specific
175  // log type, return false
176  $logRestrictions = $this->context->getConfig()->get( MainConfigNames::LogRestrictions );
177  $type = $this->entry->getType();
178  return !isset( $logRestrictions[$type] )
179  || $this->context->getAuthority()->isAllowed( $logRestrictions[$type] );
180  }
181 
187  protected function canView( $field ) {
188  if ( $this->audience == self::FOR_THIS_USER ) {
190  $this->entry->getDeleted(), $field, $this->context->getAuthority() ) &&
192  } else {
193  return !$this->entry->isDeleted( $field ) && self::canViewLogType();
194  }
195  }
196 
203  public function setShowUserToolLinks( $value ) {
204  $this->linkFlood = $value;
205  }
206 
215  public function getPlainActionText() {
216  $this->plaintext = true;
217  $text = $this->getActionText();
218  $this->plaintext = false;
219 
220  return $text;
221  }
222 
229  public function getIRCActionComment() {
230  $actionComment = $this->getIRCActionText();
231  $comment = $this->entry->getComment();
232 
233  if ( $comment != '' ) {
234  if ( $actionComment == '' ) {
235  $actionComment = $comment;
236  } else {
237  $actionComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
238  }
239  }
240 
241  return $actionComment;
242  }
243 
251  public function getIRCActionText() {
252  $this->plaintext = true;
253  $this->irctext = true;
254 
256  $parameters = $entry->getParameters();
257  // @see LogPage::actionText()
258  // Text of title the action is aimed at.
259  $target = $entry->getTarget()->getPrefixedText();
260  $text = null;
261  $contLang = MediaWikiServices::getInstance()->getContentLanguage();
262  switch ( $entry->getType() ) {
263  case 'move':
264  switch ( $entry->getSubtype() ) {
265  case 'move':
266  $movesource = $parameters['4::target'];
267  $text = wfMessage( '1movedto2' )
268  ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
269  break;
270  case 'move_redir':
271  $movesource = $parameters['4::target'];
272  $text = wfMessage( '1movedto2_redir' )
273  ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
274  break;
275  case 'move-noredirect':
276  break;
277  case 'move_redir-noredirect':
278  break;
279  }
280  break;
281 
282  case 'delete':
283  switch ( $entry->getSubtype() ) {
284  case 'delete':
285  $text = wfMessage( 'deletedarticle' )
286  ->rawParams( $target )->inContentLanguage()->escaped();
287  break;
288  case 'restore':
289  $text = wfMessage( 'undeletedarticle' )
290  ->rawParams( $target )->inContentLanguage()->escaped();
291  break;
292  }
293  break;
294 
295  case 'patrol':
296  // https://github.com/wikimedia/mediawiki/commit/1a05f8faf78675dc85984f27f355b8825b43efff
297  // Create a diff link to the patrolled revision
298  if ( $entry->getSubtype() === 'patrol' ) {
299  $diffLink = htmlspecialchars(
300  wfMessage( 'patrol-log-diff', $parameters['4::curid'] )
301  ->inContentLanguage()->text() );
302  $text = wfMessage( 'patrol-log-line', $diffLink, "[[$target]]", "" )
303  ->inContentLanguage()->text();
304  } else {
305  // broken??
306  }
307  break;
308 
309  case 'protect':
310  switch ( $entry->getSubtype() ) {
311  case 'protect':
312  $text = wfMessage( 'protectedarticle' )
313  ->rawParams( $target . ' ' . $parameters['4::description'] )
314  ->inContentLanguage()
315  ->escaped();
316  break;
317  case 'unprotect':
318  $text = wfMessage( 'unprotectedarticle' )
319  ->rawParams( $target )->inContentLanguage()->escaped();
320  break;
321  case 'modify':
322  $text = wfMessage( 'modifiedarticleprotection' )
323  ->rawParams( $target . ' ' . $parameters['4::description'] )
324  ->inContentLanguage()
325  ->escaped();
326  break;
327  case 'move_prot':
328  $text = wfMessage( 'movedarticleprotection' )
329  ->rawParams( $target, $parameters['4::oldtitle'] )->inContentLanguage()->escaped();
330  break;
331  }
332  break;
333 
334  case 'newusers':
335  switch ( $entry->getSubtype() ) {
336  case 'newusers':
337  case 'create':
338  $text = wfMessage( 'newuserlog-create-entry' )
339  ->inContentLanguage()->escaped();
340  break;
341  case 'create2':
342  case 'byemail':
343  $text = wfMessage( 'newuserlog-create2-entry' )
344  ->rawParams( $target )->inContentLanguage()->escaped();
345  break;
346  case 'autocreate':
347  $text = wfMessage( 'newuserlog-autocreate-entry' )
348  ->inContentLanguage()->escaped();
349  break;
350  }
351  break;
352 
353  case 'upload':
354  switch ( $entry->getSubtype() ) {
355  case 'upload':
356  $text = wfMessage( 'uploadedimage' )
357  ->rawParams( $target )->inContentLanguage()->escaped();
358  break;
359  case 'overwrite':
360  case 'revert':
361  $text = wfMessage( 'overwroteimage' )
362  ->rawParams( $target )->inContentLanguage()->escaped();
363  break;
364  }
365  break;
366 
367  case 'rights':
368  if ( count( $parameters['4::oldgroups'] ) ) {
369  $oldgroups = implode( ', ', $parameters['4::oldgroups'] );
370  } else {
371  $oldgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
372  }
373  if ( count( $parameters['5::newgroups'] ) ) {
374  $newgroups = implode( ', ', $parameters['5::newgroups'] );
375  } else {
376  $newgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
377  }
378  switch ( $entry->getSubtype() ) {
379  case 'rights':
380  $text = wfMessage( 'rightslogentry' )
381  ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
382  break;
383  case 'autopromote':
384  $text = wfMessage( 'rightslogentry-autopromote' )
385  ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
386  break;
387  }
388  break;
389 
390  case 'merge':
391  $text = wfMessage( 'pagemerge-logentry' )
392  ->rawParams( $target, $parameters['4::dest'], $parameters['5::mergepoint'] )
393  ->inContentLanguage()->escaped();
394  break;
395 
396  case 'block':
397  switch ( $entry->getSubtype() ) {
398  case 'block':
399  // Keep compatibility with extensions by checking for
400  // new key (5::duration/6::flags) or old key (0/optional 1)
401  if ( $entry->isLegacy() ) {
402  $rawDuration = $parameters[0];
403  $rawFlags = $parameters[1] ?? '';
404  } else {
405  $rawDuration = $parameters['5::duration'];
406  $rawFlags = $parameters['6::flags'];
407  }
408  $duration = $contLang->translateBlockExpiry(
409  $rawDuration,
410  null,
411  (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
412  );
413  $flags = BlockLogFormatter::formatBlockFlags( $rawFlags, $contLang );
414  $text = wfMessage( 'blocklogentry' )
415  ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
416  break;
417  case 'unblock':
418  $text = wfMessage( 'unblocklogentry' )
419  ->rawParams( $target )->inContentLanguage()->escaped();
420  break;
421  case 'reblock':
422  $duration = $contLang->translateBlockExpiry(
423  $parameters['5::duration'],
424  null,
425  (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() )
426  );
427  $flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'],
428  $contLang );
429  $text = wfMessage( 'reblock-logentry' )
430  ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
431  break;
432  }
433  break;
434 
435  case 'import':
436  switch ( $entry->getSubtype() ) {
437  case 'upload':
438  $text = wfMessage( 'import-logentry-upload' )
439  ->rawParams( $target )->inContentLanguage()->escaped();
440  break;
441  case 'interwiki':
442  $text = wfMessage( 'import-logentry-interwiki' )
443  ->rawParams( $target )->inContentLanguage()->escaped();
444  break;
445  }
446  break;
447  // case 'suppress' --private log -- aaron (so we know who to blame in a few years :-D)
448  // default:
449  }
450 
451  $this->plaintext = false;
452  $this->irctext = false;
453 
454  return $text ?? $this->getPlainActionText();
455  }
456 
464  public function getActionText() {
465  if ( $this->canView( LogPage::DELETED_ACTION ) ) {
466  $element = $this->getActionMessage();
467  if ( $element instanceof Message ) {
468  $element = $this->plaintext ? $element->text() : $element->escaped();
469  }
470  if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
471  $element = $this->styleRestrictedElement( $element );
472  }
473  } else {
474  $sep = $this->msg( 'word-separator' );
475  $sep = $this->plaintext ? $sep->text() : $sep->escaped();
476  $performer = $this->getPerformerElement();
477  $element = $performer . $sep . $this->getRestrictedElement( 'rev-deleted-event' );
478  }
479 
480  return $element;
481  }
482 
489  protected function getActionMessage() {
490  $message = $this->msg( $this->getMessageKey() );
491  $message->params( $this->getMessageParameters() );
492 
493  return $message;
494  }
495 
504  protected function getMessageKey() {
505  $type = $this->entry->getType();
506  $subtype = $this->entry->getSubtype();
507 
508  return "logentry-$type-$subtype";
509  }
510 
517  public function getActionLinks() {
518  return '';
519  }
520 
527  protected function extractParameters() {
529  $params = [];
530 
531  if ( $entry->isLegacy() ) {
532  foreach ( $entry->getParameters() as $index => $value ) {
533  $params[$index + 3] = $value;
534  }
535  }
536 
537  // Filter out parameters which are not in format #:foo
538  foreach ( $entry->getParameters() as $key => $value ) {
539  if ( strpos( $key, ':' ) === false ) {
540  continue;
541  }
542  [ $index, $type, ] = explode( ':', $key, 3 );
543  if ( ctype_digit( $index ) ) {
544  $params[(int)$index - 1] = $this->formatParameterValue( $type, $value );
545  }
546  }
547 
548  /* Message class doesn't like non consecutive numbering.
549  * Fill in missing indexes with empty strings to avoid
550  * incorrect renumbering.
551  */
552  if ( count( $params ) ) {
553  $max = max( array_keys( $params ) );
554  // index 0 to 2 are added in getMessageParameters
555  for ( $i = 3; $i < $max; $i++ ) {
556  if ( !isset( $params[$i] ) ) {
557  $params[$i] = '';
558  }
559  }
560  }
561 
562  return $params;
563  }
564 
575  protected function getMessageParameters() {
576  if ( isset( $this->parsedParameters ) ) {
578  }
579 
581  $params = $this->extractParameters();
582  $params[0] = Message::rawParam( $this->getPerformerElement() );
583  $params[1] = $this->canView( LogPage::DELETED_USER ) ? $entry->getPerformerIdentity()->getName() : '';
584  $params[2] = Message::rawParam( $this->makePageLink( $entry->getTarget() ) );
585 
586  // Bad things happens if the numbers are not in correct order
587  ksort( $params );
588 
589  $this->parsedParameters = $params;
591  }
592 
619  protected function formatParameterValue( $type, $value ) {
620  $saveLinkFlood = $this->linkFlood;
621 
622  switch ( strtolower( trim( $type ) ) ) {
623  case 'raw':
624  $value = Message::rawParam( $value );
625  break;
626  case 'list':
627  $value = $this->context->getLanguage()->commaList( $value );
628  break;
629  case 'msg':
630  $value = $this->msg( $value )->text();
631  break;
632  case 'msg-content':
633  $value = $this->msg( $value )->inContentLanguage()->text();
634  break;
635  case 'number':
636  $value = Message::numParam( $value );
637  break;
638  case 'user':
639  $user = User::newFromName( $value );
640  $value = $user->getName();
641  break;
642  case 'user-link':
643  $this->setShowUserToolLinks( false );
644 
645  $user = User::newFromName( $value );
646 
647  if ( !$user ) {
648  $value = $this->msg( 'empty-username' )->text();
649  } else {
650  $value = Message::rawParam( $this->makeUserLink( $user ) );
651  $this->setShowUserToolLinks( $saveLinkFlood );
652  }
653  break;
654  case 'title':
655  $title = Title::newFromText( $value );
656  $value = $title->getPrefixedText();
657  break;
658  case 'title-link':
659  $title = Title::newFromText( $value );
660  $value = Message::rawParam( $this->makePageLink( $title ) );
661  break;
662  case 'plain':
663  // Plain text, nothing to do
664  default:
665  // Catch other types and use the old behavior (return as-is)
666  }
667 
668  return $value;
669  }
670 
681  protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
682  if ( !$title instanceof Title ) {
683  $msg = $this->msg( 'invalidtitle' )->text();
684  if ( $this->plaintext ) {
685  return $msg;
686  } else {
687  return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ], $msg );
688  }
689  }
690 
691  if ( $this->plaintext ) {
692  $link = '[[' . $title->getPrefixedText() . ']]';
693  } else {
694  $html = $html !== null ? new HtmlArmor( $html ) : $html;
695  $link = $this->getLinkRenderer()->makeLink( $title, $html, [], $parameters );
696  }
697 
698  return $link;
699  }
700 
707  public function getPerformerElement() {
708  if ( $this->canView( LogPage::DELETED_USER ) ) {
709  $performerIdentity = $this->entry->getPerformerIdentity();
710  $element = $this->makeUserLink( $performerIdentity );
711  if ( $this->entry->isDeleted( LogPage::DELETED_USER ) ) {
712  $element = $this->styleRestrictedElement( $element );
713  }
714  } else {
715  $element = $this->getRestrictedElement( 'rev-deleted-user' );
716  }
717 
718  return $element;
719  }
720 
726  public function getComment() {
727  if ( $this->canView( LogPage::DELETED_COMMENT ) ) {
728  $comment = MediaWikiServices::getInstance()->getCommentFormatter()
729  ->formatBlock( $this->entry->getComment() );
730  // No hard coded spaces thanx
731  $element = ltrim( $comment );
732  if ( $this->entry->isDeleted( LogPage::DELETED_COMMENT ) ) {
733  $element = $this->styleRestrictedElement( $element );
734  }
735  } else {
736  $element = $this->getRestrictedElement( 'rev-deleted-comment' );
737  }
738 
739  return $element;
740  }
741 
748  protected function getRestrictedElement( $message ) {
749  if ( $this->plaintext ) {
750  return $this->msg( $message )->text();
751  }
752 
753  $content = $this->msg( $message )->escaped();
754  $attribs = [ 'class' => 'history-deleted' ];
755 
756  return Html::rawElement( 'span', $attribs, $content );
757  }
758 
764  protected function styleRestrictedElement( $content ) {
765  if ( $this->plaintext ) {
766  return $content;
767  }
768  $attribs = [ 'class' => 'history-deleted' ];
769 
770  return Html::rawElement( 'span', $attribs, $content );
771  }
772 
779  protected function msg( $key, ...$params ) {
780  return $this->context->msg( $key, ...$params );
781  }
782 
789  protected function makeUserLink( UserIdentity $user, $toolFlags = 0 ) {
790  if ( $this->plaintext ) {
791  $element = $user->getName();
792  } else {
793  $element = Linker::userLink(
794  $user->getId(),
795  $user->getName()
796  );
797  if ( $this->linkFlood ) {
798  $editCount = $user->isRegistered()
799  ? MediaWikiServices::getInstance()->getUserEditTracker()->getUserEditCount( $user )
800  : null;
801 
802  $element .= Linker::userToolLinks(
803  $user->getId(),
804  $user->getName(),
805  true, // redContribsWhenNoEdits
806  $toolFlags,
807  $editCount,
808  // do not render parentheses in the HTML markup (CSS will provide)
809  false
810  );
811  }
812  }
813 
814  return $element;
815  }
816 
821  public function getPreloadTitles() {
822  return [];
823  }
824 
828  public function getMessageParametersForTesting() {
829  // This function was added because getMessageParameters() is
830  // protected and a change from protected to public caused
831  // problems with extensions
832  return $this->getMessageParameters();
833  }
834 
841  protected function getParametersForApi() {
842  return $this->entry->getParameters();
843  }
844 
860  public function formatParametersForApi() {
861  $logParams = [];
862  foreach ( $this->getParametersForApi() as $key => $value ) {
863  $vals = explode( ':', $key, 3 );
864  if ( count( $vals ) !== 3 ) {
865  if ( $value instanceof __PHP_Incomplete_Class ) {
866  wfLogWarning( 'Log entry of type ' . $this->entry->getFullType() .
867  ' contains unrecoverable extra parameters.' );
868  continue;
869  }
870  $logParams[$key] = $value;
871  continue;
872  }
873  $logParams += $this->formatParameterValueForApi( $vals[2], $vals[1], $value );
874  }
875  ApiResult::setIndexedTagName( $logParams, 'param' );
876  ApiResult::setArrayType( $logParams, 'assoc' );
877 
878  return $logParams;
879  }
880 
890  protected function formatParameterValueForApi( $name, $type, $value ) {
891  $type = strtolower( trim( $type ) );
892  switch ( $type ) {
893  case 'bool':
894  $value = (bool)$value;
895  break;
896 
897  case 'number':
898  if ( is_int( $value ) || ctype_digit( (string)$value ) ) {
899  $value = (int)$value;
900  } else {
901  $value = (float)$value;
902  }
903  break;
904 
905  case 'array':
906  case 'assoc':
907  case 'kvp':
908  if ( is_array( $value ) ) {
909  ApiResult::setArrayType( $value, $type );
910  }
911  break;
912 
913  case 'timestamp':
914  $value = wfTimestamp( TS_ISO_8601, $value );
915  break;
916 
917  case 'msg':
918  case 'msg-content':
919  $msg = $this->msg( $value );
920  if ( $type === 'msg-content' ) {
921  $msg->inContentLanguage();
922  }
923  $value = [];
924  $value["{$name}_key"] = $msg->getKey();
925  if ( $msg->getParams() ) {
926  $value["{$name}_params"] = $msg->getParams();
927  }
928  $value["{$name}_text"] = $msg->text();
929  return $value;
930 
931  case 'title':
932  case 'title-link':
933  $title = Title::newFromText( $value );
934  if ( !$title ) {
935  $title = SpecialPage::getTitleFor( 'Badtitle', $value );
936  }
937  $value = [];
938  ApiQueryBase::addTitleInfo( $value, $title, "{$name}_" );
939  return $value;
940 
941  case 'user':
942  case 'user-link':
943  $user = User::newFromName( $value );
944  if ( $user ) {
945  $value = $user->getName();
946  }
947  break;
948 
949  default:
950  // do nothing
951  break;
952  }
953 
954  return [ $name => $value ];
955  }
956 }
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.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
Definition: ApiResult.php:716
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:604
static formatBlockFlags( $flags, Language $lang)
Convert a comma-delimited list of block log flags into a more readable (and translated) form.
static newFromRow( $row)
Constructs new LogEntry from database result row.
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:30
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:236
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:214
This class formats all log entries for log types which have not been converted to the new system.
isLegacy()
Whether the parameters for this log are stored in new or old format.
getFullType()
The full logtype in format maintype/subtype.
static userCanBitfield( $bitfield, $field, Authority $performer)
Determine if the current user is allowed to view a particular field of this log row,...
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.
const FOR_PUBLIC
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.
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.
makeUserLink(UserIdentity $user, $toolFlags=0)
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.
const DELETED_USER
Definition: LogPage.php:43
const DELETED_COMMENT
Definition: LogPage.php:42
const DELETED_ACTION
Definition: LogPage.php:41
Class that generates HTML anchor link elements for pages.
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.
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition: Message.php:143
static rawParam( $raw)
Definition: Message.php:1134
static numParam( $num)
Definition: Message.php:1145
static getMain()
Get the RequestContext object associated with the main request.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Represents a title within MediaWiki.
Definition: Title.php:52
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:373
static newFromName( $name, $validate='valid')
Definition: User.php:591
Interface for objects which can provide a MediaWiki context on request.
An individual log entry.
Definition: LogEntry.php:34
getPerformerIdentity()
getParameters()
Get the extra parameters stored for this message.
getTimestamp()
Get the timestamp when the action was executed.
getTarget()
Get the target page of this action.
getSubtype()
The log subtype.
getType()
The main log type.
Interface for objects representing user identity.
getId( $wikiId=self::LOCAL)
$content
Definition: router.php:76