MediaWiki  1.34.0
LogFormatter.php
Go to the documentation of this file.
1 <?php
27 
38 class LogFormatter {
39  // Audience options for viewing usernames, comments, and actions
40  const FOR_PUBLIC = 1;
41  const FOR_THIS_USER = 2;
42 
43  // Static->
44 
50  public static function newFromEntry( LogEntry $entry ) {
51  global $wgLogActionsHandlers;
52  $fulltype = $entry->getFullType();
53  $wildcard = $entry->getType() . '/*';
54  $handler = $wgLogActionsHandlers[$fulltype] ?? $wgLogActionsHandlers[$wildcard] ?? '';
55 
56  if ( $handler !== '' && is_string( $handler ) && class_exists( $handler ) ) {
57  return new $handler( $entry );
58  }
59 
60  return new LegacyLogFormatter( $entry );
61  }
62 
70  public static function newFromRow( $row ) {
72  }
73 
74  // Nonstatic->
75 
77  protected $entry;
78 
81 
83  public $context;
84 
86  protected $linkFlood = false;
87 
95  protected $plaintext = false;
96 
98  protected $irctext = false;
99 
103  private $linkRenderer;
104 
109  protected $parsedParameters;
110 
111  protected function __construct( LogEntry $entry ) {
112  $this->entry = $entry;
113  $this->context = RequestContext::getMain();
114  }
115 
120  public function setContext( IContextSource $context ) {
121  $this->context = $context;
122  }
123 
129  $this->linkRenderer = $linkRenderer;
130  }
131 
136  public function getLinkRenderer() {
137  if ( $this->linkRenderer !== null ) {
138  return $this->linkRenderer;
139  } else {
140  return MediaWikiServices::getInstance()->getLinkRenderer();
141  }
142  }
143 
150  public function setAudience( $audience ) {
151  $this->audience = ( $audience == self::FOR_THIS_USER )
152  ? self::FOR_THIS_USER
153  : self::FOR_PUBLIC;
154  }
155 
160  public function canViewLogType() {
161  // If the user doesn't have the right permission to view the specific
162  // log type, return false
163  $logRestrictions = $this->context->getConfig()->get( 'LogRestrictions' );
164  $type = $this->entry->getType();
165  return !isset( $logRestrictions[$type] )
166  || MediaWikiServices::getInstance()
167  ->getPermissionManager()
168  ->userHasRight( $this->context->getUser(), $logRestrictions[$type] );
169  }
170 
176  protected function canView( $field ) {
177  if ( $this->audience == self::FOR_THIS_USER ) {
179  $this->entry->getDeleted(), $field, $this->context->getUser() ) &&
180  self::canViewLogType();
181  } else {
182  return !$this->entry->isDeleted( $field ) && self::canViewLogType();
183  }
184  }
185 
192  public function setShowUserToolLinks( $value ) {
193  $this->linkFlood = $value;
194  }
195 
204  public function getPlainActionText() {
205  $this->plaintext = true;
206  $text = $this->getActionText();
207  $this->plaintext = false;
208 
209  return $text;
210  }
211 
218  public function getIRCActionComment() {
219  $actionComment = $this->getIRCActionText();
220  $comment = $this->entry->getComment();
221 
222  if ( $comment != '' ) {
223  if ( $actionComment == '' ) {
224  $actionComment = $comment;
225  } else {
226  $actionComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
227  }
228  }
229 
230  return $actionComment;
231  }
232 
239  public function getIRCActionText() {
240  $this->plaintext = true;
241  $this->irctext = true;
242 
244  $parameters = $entry->getParameters();
245  // @see LogPage::actionText()
246  // Text of title the action is aimed at.
247  $target = $entry->getTarget()->getPrefixedText();
248  $text = null;
249  $contLang = MediaWikiServices::getInstance()->getContentLanguage();
250  switch ( $entry->getType() ) {
251  case 'move':
252  switch ( $entry->getSubtype() ) {
253  case 'move':
254  $movesource = $parameters['4::target'];
255  $text = wfMessage( '1movedto2' )
256  ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
257  break;
258  case 'move_redir':
259  $movesource = $parameters['4::target'];
260  $text = wfMessage( '1movedto2_redir' )
261  ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
262  break;
263  case 'move-noredirect':
264  break;
265  case 'move_redir-noredirect':
266  break;
267  }
268  break;
269 
270  case 'delete':
271  switch ( $entry->getSubtype() ) {
272  case 'delete':
273  $text = wfMessage( 'deletedarticle' )
274  ->rawParams( $target )->inContentLanguage()->escaped();
275  break;
276  case 'restore':
277  $text = wfMessage( 'undeletedarticle' )
278  ->rawParams( $target )->inContentLanguage()->escaped();
279  break;
280  //case 'revision': // Revision deletion
281  //case 'event': // Log deletion
282  // see https://github.com/wikimedia/mediawiki/commit/a9c243b7b5289dad204278dbe7ed571fd914e395
283  //default:
284  }
285  break;
286 
287  case 'patrol':
288  // https://github.com/wikimedia/mediawiki/commit/1a05f8faf78675dc85984f27f355b8825b43efff
289  // Create a diff link to the patrolled revision
290  if ( $entry->getSubtype() === 'patrol' ) {
291  $diffLink = htmlspecialchars(
292  wfMessage( 'patrol-log-diff', $parameters['4::curid'] )
293  ->inContentLanguage()->text() );
294  $text = wfMessage( 'patrol-log-line', $diffLink, "[[$target]]", "" )
295  ->inContentLanguage()->text();
296  } else {
297  // broken??
298  }
299  break;
300 
301  case 'protect':
302  switch ( $entry->getSubtype() ) {
303  case 'protect':
304  $text = wfMessage( 'protectedarticle' )
305  ->rawParams( $target . ' ' . $parameters['4::description'] )->inContentLanguage()->escaped();
306  break;
307  case 'unprotect':
308  $text = wfMessage( 'unprotectedarticle' )
309  ->rawParams( $target )->inContentLanguage()->escaped();
310  break;
311  case 'modify':
312  $text = wfMessage( 'modifiedarticleprotection' )
313  ->rawParams( $target . ' ' . $parameters['4::description'] )->inContentLanguage()->escaped();
314  break;
315  case 'move_prot':
316  $text = wfMessage( 'movedarticleprotection' )
317  ->rawParams( $target, $parameters['4::oldtitle'] )->inContentLanguage()->escaped();
318  break;
319  }
320  break;
321 
322  case 'newusers':
323  switch ( $entry->getSubtype() ) {
324  case 'newusers':
325  case 'create':
326  $text = wfMessage( 'newuserlog-create-entry' )
327  ->inContentLanguage()->escaped();
328  break;
329  case 'create2':
330  case 'byemail':
331  $text = wfMessage( 'newuserlog-create2-entry' )
332  ->rawParams( $target )->inContentLanguage()->escaped();
333  break;
334  case 'autocreate':
335  $text = wfMessage( 'newuserlog-autocreate-entry' )
336  ->inContentLanguage()->escaped();
337  break;
338  }
339  break;
340 
341  case 'upload':
342  switch ( $entry->getSubtype() ) {
343  case 'upload':
344  $text = wfMessage( 'uploadedimage' )
345  ->rawParams( $target )->inContentLanguage()->escaped();
346  break;
347  case 'overwrite':
348  case 'revert':
349  $text = wfMessage( 'overwroteimage' )
350  ->rawParams( $target )->inContentLanguage()->escaped();
351  break;
352  }
353  break;
354 
355  case 'rights':
356  if ( count( $parameters['4::oldgroups'] ) ) {
357  $oldgroups = implode( ', ', $parameters['4::oldgroups'] );
358  } else {
359  $oldgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
360  }
361  if ( count( $parameters['5::newgroups'] ) ) {
362  $newgroups = implode( ', ', $parameters['5::newgroups'] );
363  } else {
364  $newgroups = wfMessage( 'rightsnone' )->inContentLanguage()->escaped();
365  }
366  switch ( $entry->getSubtype() ) {
367  case 'rights':
368  $text = wfMessage( 'rightslogentry' )
369  ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
370  break;
371  case 'autopromote':
372  $text = wfMessage( 'rightslogentry-autopromote' )
373  ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
374  break;
375  }
376  break;
377 
378  case 'merge':
379  $text = wfMessage( 'pagemerge-logentry' )
380  ->rawParams( $target, $parameters['4::dest'], $parameters['5::mergepoint'] )
381  ->inContentLanguage()->escaped();
382  break;
383 
384  case 'block':
385  switch ( $entry->getSubtype() ) {
386  case 'block':
387  // Keep compatibility with extensions by checking for
388  // new key (5::duration/6::flags) or old key (0/optional 1)
389  if ( $entry->isLegacy() ) {
390  $rawDuration = $parameters[0];
391  $rawFlags = $parameters[1] ?? '';
392  } else {
393  $rawDuration = $parameters['5::duration'];
394  $rawFlags = $parameters['6::flags'];
395  }
396  $duration = $contLang->translateBlockExpiry(
397  $rawDuration,
398  null,
399  wfTimestamp( TS_UNIX, $entry->getTimestamp() )
400  );
401  $flags = BlockLogFormatter::formatBlockFlags( $rawFlags, $contLang );
402  $text = wfMessage( 'blocklogentry' )
403  ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
404  break;
405  case 'unblock':
406  $text = wfMessage( 'unblocklogentry' )
407  ->rawParams( $target )->inContentLanguage()->escaped();
408  break;
409  case 'reblock':
410  $duration = $contLang->translateBlockExpiry(
411  $parameters['5::duration'],
412  null,
413  wfTimestamp( TS_UNIX, $entry->getTimestamp() )
414  );
415  $flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'],
416  $contLang );
417  $text = wfMessage( 'reblock-logentry' )
418  ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
419  break;
420  }
421  break;
422 
423  case 'import':
424  switch ( $entry->getSubtype() ) {
425  case 'upload':
426  $text = wfMessage( 'import-logentry-upload' )
427  ->rawParams( $target )->inContentLanguage()->escaped();
428  break;
429  case 'interwiki':
430  $text = wfMessage( 'import-logentry-interwiki' )
431  ->rawParams( $target )->inContentLanguage()->escaped();
432  break;
433  }
434  break;
435  // case 'suppress' --private log -- aaron (so we know who to blame in a few years :-D)
436  // default:
437  }
438  if ( is_null( $text ) ) {
439  $text = $this->getPlainActionText();
440  }
441 
442  $this->plaintext = false;
443  $this->irctext = false;
444 
445  return $text;
446  }
447 
454  public function getActionText() {
455  if ( $this->canView( LogPage::DELETED_ACTION ) ) {
456  $element = $this->getActionMessage();
457  if ( $element instanceof Message ) {
458  $element = $this->plaintext ? $element->text() : $element->escaped();
459  }
460  if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
461  $element = $this->styleRestricedElement( $element );
462  }
463  } else {
464  $sep = $this->msg( 'word-separator' );
465  $sep = $this->plaintext ? $sep->text() : $sep->escaped();
466  $performer = $this->getPerformerElement();
467  $element = $performer . $sep . $this->getRestrictedElement( 'rev-deleted-event' );
468  }
469 
470  return $element;
471  }
472 
479  protected function getActionMessage() {
480  $message = $this->msg( $this->getMessageKey() );
481  $message->params( $this->getMessageParameters() );
482 
483  return $message;
484  }
485 
493  protected function getMessageKey() {
494  $type = $this->entry->getType();
495  $subtype = $this->entry->getSubtype();
496 
497  return "logentry-$type-$subtype";
498  }
499 
505  public function getActionLinks() {
506  return '';
507  }
508 
514  protected function extractParameters() {
516  $params = [];
517 
518  if ( $entry->isLegacy() ) {
519  foreach ( $entry->getParameters() as $index => $value ) {
520  $params[$index + 3] = $value;
521  }
522  }
523 
524  // Filter out parameters which are not in format #:foo
525  foreach ( $entry->getParameters() as $key => $value ) {
526  if ( strpos( $key, ':' ) === false ) {
527  continue;
528  }
529  list( $index, $type, ) = explode( ':', $key, 3 );
530  if ( ctype_digit( $index ) ) {
531  $params[$index - 1] = $this->formatParameterValue( $type, $value );
532  }
533  }
534 
535  /* Message class doesn't like non consecutive numbering.
536  * Fill in missing indexes with empty strings to avoid
537  * incorrect renumbering.
538  */
539  if ( count( $params ) ) {
540  $max = max( array_keys( $params ) );
541  // index 0 to 2 are added in getMessageParameters
542  for ( $i = 3; $i < $max; $i++ ) {
543  if ( !isset( $params[$i] ) ) {
544  $params[$i] = '';
545  }
546  }
547  }
548 
549  return $params;
550  }
551 
561  protected function getMessageParameters() {
562  if ( isset( $this->parsedParameters ) ) {
564  }
565 
567  $params = $this->extractParameters();
568  $params[0] = Message::rawParam( $this->getPerformerElement() );
569  $params[1] = $this->canView( LogPage::DELETED_USER ) ? $entry->getPerformer()->getName() : '';
570  $params[2] = Message::rawParam( $this->makePageLink( $entry->getTarget() ) );
571 
572  // Bad things happens if the numbers are not in correct order
573  ksort( $params );
574 
575  $this->parsedParameters = $params;
577  }
578 
605  protected function formatParameterValue( $type, $value ) {
606  $saveLinkFlood = $this->linkFlood;
607 
608  switch ( strtolower( trim( $type ) ) ) {
609  case 'raw':
610  $value = Message::rawParam( $value );
611  break;
612  case 'list':
613  $value = $this->context->getLanguage()->commaList( $value );
614  break;
615  case 'msg':
616  $value = $this->msg( $value )->text();
617  break;
618  case 'msg-content':
619  $value = $this->msg( $value )->inContentLanguage()->text();
620  break;
621  case 'number':
622  $value = Message::numParam( $value );
623  break;
624  case 'user':
625  $user = User::newFromName( $value );
626  $value = $user->getName();
627  break;
628  case 'user-link':
629  $this->setShowUserToolLinks( false );
630 
631  $user = User::newFromName( $value );
632 
633  if ( !$user ) {
634  $value = $this->msg( 'empty-username' )->text();
635  } else {
636  $value = Message::rawParam( $this->makeUserLink( $user ) );
637  $this->setShowUserToolLinks( $saveLinkFlood );
638  }
639  break;
640  case 'title':
641  $title = Title::newFromText( $value );
642  $value = $title->getPrefixedText();
643  break;
644  case 'title-link':
645  $title = Title::newFromText( $value );
646  $value = Message::rawParam( $this->makePageLink( $title ) );
647  break;
648  case 'plain':
649  // Plain text, nothing to do
650  default:
651  // Catch other types and use the old behavior (return as-is)
652  }
653 
654  return $value;
655  }
656 
665  protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
666  if ( !$title instanceof Title ) {
667  $msg = $this->msg( 'invalidtitle' )->text();
668  if ( $this->plaintext ) {
669  return $msg;
670  } else {
671  return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ], $msg );
672  }
673  }
674 
675  if ( $this->plaintext ) {
676  $link = '[[' . $title->getPrefixedText() . ']]';
677  } else {
678  $html = $html !== null ? new HtmlArmor( $html ) : $html;
679  $link = $this->getLinkRenderer()->makeLink( $title, $html, [], $parameters );
680  }
681 
682  return $link;
683  }
684 
691  public function getPerformerElement() {
692  if ( $this->canView( LogPage::DELETED_USER ) ) {
693  $performer = $this->entry->getPerformer();
694  $element = $this->makeUserLink( $performer );
695  if ( $this->entry->isDeleted( LogPage::DELETED_USER ) ) {
696  $element = $this->styleRestricedElement( $element );
697  }
698  } else {
699  $element = $this->getRestrictedElement( 'rev-deleted-user' );
700  }
701 
702  return $element;
703  }
704 
709  public function getComment() {
710  if ( $this->canView( LogPage::DELETED_COMMENT ) ) {
711  $comment = Linker::commentBlock( $this->entry->getComment() );
712  // No hard coded spaces thanx
713  $element = ltrim( $comment );
714  if ( $this->entry->isDeleted( LogPage::DELETED_COMMENT ) ) {
715  $element = $this->styleRestricedElement( $element );
716  }
717  } else {
718  $element = $this->getRestrictedElement( 'rev-deleted-comment' );
719  }
720 
721  return $element;
722  }
723 
730  protected function getRestrictedElement( $message ) {
731  if ( $this->plaintext ) {
732  return $this->msg( $message )->text();
733  }
734 
735  $content = $this->msg( $message )->escaped();
736  $attribs = [ 'class' => 'history-deleted' ];
737 
738  return Html::rawElement( 'span', $attribs, $content );
739  }
740 
746  protected function styleRestricedElement( $content ) {
747  if ( $this->plaintext ) {
748  return $content;
749  }
750  $attribs = [ 'class' => 'history-deleted' ];
751 
752  return Html::rawElement( 'span', $attribs, $content );
753  }
754 
761  protected function msg( $key, ...$params ) {
762  return $this->context->msg( $key, ...$params );
763  }
764 
771  protected function makeUserLink( User $user, $toolFlags = 0 ) {
772  if ( $this->plaintext ) {
773  $element = $user->getName();
774  } else {
775  $element = Linker::userLink(
776  $user->getId(),
777  $user->getName()
778  );
779 
780  if ( $this->linkFlood ) {
781  $element .= Linker::userToolLinks(
782  $user->getId(),
783  $user->getName(),
784  true, // redContribsWhenNoEdits
785  $toolFlags,
786  $user->getEditCount(),
787  // do not render parenthesises in the HTML markup (CSS will provide)
788  false
789  );
790  }
791  }
792 
793  return $element;
794  }
795 
799  public function getPreloadTitles() {
800  return [];
801  }
802 
806  public function getMessageParametersForTesting() {
807  // This function was added because getMessageParameters() is
808  // protected and a change from protected to public caused
809  // problems with extensions
810  return $this->getMessageParameters();
811  }
812 
818  protected function getParametersForApi() {
819  return $this->entry->getParameters();
820  }
821 
836  public function formatParametersForApi() {
837  $logParams = [];
838  foreach ( $this->getParametersForApi() as $key => $value ) {
839  $vals = explode( ':', $key, 3 );
840  if ( count( $vals ) !== 3 ) {
841  if ( $value instanceof __PHP_Incomplete_Class ) {
842  wfLogWarning( 'Log entry of type ' . $this->entry->getFullType() .
843  ' contains unrecoverable extra parameters.' );
844  continue;
845  }
846  $logParams[$key] = $value;
847  continue;
848  }
849  $logParams += $this->formatParameterValueForApi( $vals[2], $vals[1], $value );
850  }
851  ApiResult::setIndexedTagName( $logParams, 'param' );
852  ApiResult::setArrayType( $logParams, 'assoc' );
853 
854  return $logParams;
855  }
856 
866  protected function formatParameterValueForApi( $name, $type, $value ) {
867  $type = strtolower( trim( $type ) );
868  switch ( $type ) {
869  case 'bool':
870  $value = (bool)$value;
871  break;
872 
873  case 'number':
874  if ( ctype_digit( $value ) || is_int( $value ) ) {
875  $value = (int)$value;
876  } else {
877  $value = (float)$value;
878  }
879  break;
880 
881  case 'array':
882  case 'assoc':
883  case 'kvp':
884  if ( is_array( $value ) ) {
885  ApiResult::setArrayType( $value, $type );
886  }
887  break;
888 
889  case 'timestamp':
890  $value = wfTimestamp( TS_ISO_8601, $value );
891  break;
892 
893  case 'msg':
894  case 'msg-content':
895  $msg = $this->msg( $value );
896  if ( $type === 'msg-content' ) {
897  $msg->inContentLanguage();
898  }
899  $value = [];
900  $value["{$name}_key"] = $msg->getKey();
901  if ( $msg->getParams() ) {
902  $value["{$name}_params"] = $msg->getParams();
903  }
904  $value["{$name}_text"] = $msg->text();
905  return $value;
906 
907  case 'title':
908  case 'title-link':
909  $title = Title::newFromText( $value );
910  if ( !$title ) {
911  // Huh? Do something halfway sane.
912  $title = SpecialPage::getTitleFor( 'Badtitle', $value );
913  }
914  $value = [];
915  ApiQueryBase::addTitleInfo( $value, $title, "{$name}_" );
916  return $value;
917 
918  case 'user':
919  case 'user-link':
920  $user = User::newFromName( $value );
921  if ( $user ) {
922  $value = $user->getName();
923  }
924  break;
925 
926  default:
927  // do nothing
928  break;
929  }
930 
931  return [ $name => $value ];
932  }
933 }
LogFormatter\FOR_THIS_USER
const FOR_THIS_USER
Definition: LogFormatter.php:41
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:316
LogFormatter\setAudience
setAudience( $audience)
Set the visibility restrictions for displaying content.
Definition: LogFormatter.php:150
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:28
LogFormatter\getActionLinks
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.
Definition: LogFormatter.php:505
User\getId
getId()
Get the user's ID.
Definition: User.php:2203
LogFormatter\getPlainActionText
getPlainActionText()
Ugly hack to produce plaintext version of the message.
Definition: LogFormatter.php:204
LogEntry\getTimestamp
getTimestamp()
Get the timestamp when the action was executed.
Linker\userLink
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
Definition: Linker.php:898
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
User\getEditCount
getEditCount()
Get the user's edit count.
Definition: User.php:3412
LogFormatter\makeUserLink
makeUserLink(User $user, $toolFlags=0)
Definition: LogFormatter.php:771
LogEntry\getParameters
getParameters()
Get the extra parameters stored for this message.
LogFormatter\FOR_PUBLIC
const FOR_PUBLIC
Definition: LogFormatter.php:40
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:41
LogFormatter\$entry
LogEntryBase $entry
Definition: LogFormatter.php:77
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1869
LogEntryBase\isLegacy
isLegacy()
Whether the parameters for this log are stored in new or old format.
Definition: LogEntryBase.php:47
Linker\userToolLinks
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null, $useParentheses=true)
Generate standard user tool links (talk, contributions, block link, etc.)
Definition: Linker.php:943
LogEntry\getTarget
getTarget()
Get the target page of this action.
LogFormatter\getIRCActionComment
getIRCActionComment()
Even uglier hack to maintain backwards compatibility with IRC bots (T36508).
Definition: LogFormatter.php:218
LogFormatter\getParametersForApi
getParametersForApi()
Get the array of parameters, converted from legacy format if necessary.
Definition: LogFormatter.php:818
LogFormatter\$audience
int $audience
Constant for handling log_deleted.
Definition: LogFormatter.php:80
LogFormatter\canView
canView( $field)
Check if a log item can be displayed.
Definition: LogFormatter.php:176
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:515
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1264
SpecialPage\getTitleFor
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,...
Definition: SpecialPage.php:83
wfLogWarning
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
Definition: GlobalFunctions.php:1078
LogFormatter\getMessageParameters
getMessageParameters()
Formats parameters intented for action message from array of all parameters.
Definition: LogFormatter.php:561
LogFormatter\$plaintext
string $plaintext
Set to true if we are constructing a message text that is going to be included in page history or sen...
Definition: LogFormatter.php:95
Message
LogFormatter\setContext
setContext(IContextSource $context)
Replace the default context.
Definition: LogFormatter.php:120
LogEntry\getType
getType()
The main log type.
LogFormatter\getComment
getComment()
Gets the user provided comment.
Definition: LogFormatter.php:709
LogFormatter\getPerformerElement
getPerformerElement()
Provides the name of the user who performed the log action.
Definition: LogFormatter.php:691
LogFormatter\__construct
__construct(LogEntry $entry)
Definition: LogFormatter.php:111
ApiResult\setArrayType
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
Definition: ApiResult.php:728
DatabaseLogEntry\newFromRow
static newFromRow( $row)
Constructs new LogEntry from database result row.
Definition: DatabaseLogEntry.php:78
LogPage\DELETED_COMMENT
const DELETED_COMMENT
Definition: LogPage.php:35
LogFormatter\newFromRow
static newFromRow( $row)
Handy shortcut for constructing a formatter directly from database row.
Definition: LogFormatter.php:70
LogEntry
Interface for log entries.
Definition: LogEntry.php:31
LogPage\DELETED_USER
const DELETED_USER
Definition: LogPage.php:36
LogFormatter\getMessageParametersForTesting
getMessageParametersForTesting()
Definition: LogFormatter.php:806
$title
$title
Definition: testCompression.php:34
LogFormatter\getIRCActionText
getIRCActionText()
Even uglier hack to maintain backwards compatibility with IRC bots (T36508).
Definition: LogFormatter.php:239
LogPage\DELETED_ACTION
const DELETED_ACTION
Definition: LogPage.php:34
LogFormatter\styleRestricedElement
styleRestricedElement( $content)
Helper method for styling restricted element.
Definition: LogFormatter.php:746
LogEntryBase
Extends the LogEntry Interface with some basic functionality.
Definition: LogEntryBase.php:31
LogFormatter\formatParameterValue
formatParameterValue( $type, $value)
Formats parameters values dependent to their type.
Definition: LogFormatter.php:605
LogFormatter\formatParameterValueForApi
formatParameterValueForApi( $name, $type, $value)
Format a single parameter value for API output.
Definition: LogFormatter.php:866
ApiResult\setIndexedTagName
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:616
$content
$content
Definition: router.php:78
LogFormatter\formatParametersForApi
formatParametersForApi()
Format parameters for API output.
Definition: LogFormatter.php:836
Linker\commentBlock
static commentBlock( $comment, $title=null, $local=false, $wikiId=null, $useParentheses=true)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
Definition: Linker.php:1547
LogFormatter\setShowUserToolLinks
setShowUserToolLinks( $value)
If set to true, will produce user tool links after the user name.
Definition: LogFormatter.php:192
LogFormatter\setLinkRenderer
setLinkRenderer(LinkRenderer $linkRenderer)
Definition: LogFormatter.php:128
LogFormatter\$parsedParameters
array $parsedParameters
Definition: LogFormatter.php:109
LogFormatter\canViewLogType
canViewLogType()
Check if a log item type can be displayed.
Definition: LogFormatter.php:160
LogEntryBase\getFullType
getFullType()
The full logtype in format maintype/subtype.
Definition: LogEntryBase.php:33
LogFormatter\getActionText
getActionText()
Gets the log action, including username.
Definition: LogFormatter.php:454
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:431
$wgLogActionsHandlers
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
Definition: DefaultSettings.php:7806
LogFormatter\getActionMessage
getActionMessage()
Returns a sentence describing the log action.
Definition: LogFormatter.php:479
LogEntry\getSubtype
getSubtype()
The log subtype.
LogFormatter
Implements the default log formatting.
Definition: LogFormatter.php:38
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:53
BlockLogFormatter\formatBlockFlags
static formatBlockFlags( $flags, Language $lang)
Convert a comma-delimited list of block log flags into a more readable (and translated) form.
Definition: BlockLogFormatter.php:175
LogFormatter\getPreloadTitles
getPreloadTitles()
Definition: LogFormatter.php:799
Title
Represents a title within MediaWiki.
Definition: Title.php:42
LogFormatter\$linkRenderer
LinkRenderer null $linkRenderer
Definition: LogFormatter.php:103
LogFormatter\$linkFlood
bool $linkFlood
Whether to output user tool links.
Definition: LogFormatter.php:86
LogEventsList\userCanBitfield
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
Definition: LogEventsList.php:547
LogFormatter\msg
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
Definition: LogFormatter.php:761
LogFormatter\getRestrictedElement
getRestrictedElement( $message)
Helper method for displaying restricted element.
Definition: LogFormatter.php:730
LogFormatter\$irctext
string $irctext
Definition: LogFormatter.php:98
LegacyLogFormatter
This class formats all log entries for log types which have not been converted to the new system.
Definition: LegacyLogFormatter.php:35
LogFormatter\getLinkRenderer
getLinkRenderer()
Definition: LogFormatter.php:136
LogFormatter\getMessageKey
getMessageKey()
Returns a key to be used for formatting the action sentence.
Definition: LogFormatter.php:493
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:51
LogEntry\getPerformer
getPerformer()
Get the user who performed this action.
User\getName
getName()
Get the user name, or the IP of an anonymous user.
Definition: User.php:2232
LogFormatter\$context
IContextSource $context
Context for logging.
Definition: LogFormatter.php:83
LogFormatter\extractParameters
extractParameters()
Extracts the optional extra parameters for use in action messages.
Definition: LogFormatter.php:514
ApiQueryBase\addTitleInfo
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
Definition: ApiQueryBase.php:443
LogFormatter\makePageLink
makePageLink(Title $title=null, $parameters=[], $html=null)
Helper to make a link to the page, taking the plaintext value in consideration.
Definition: LogFormatter.php:665
LogFormatter\newFromEntry
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
Definition: LogFormatter.php:50
$type
$type
Definition: testCompression.php:48