MediaWiki  1.28.3
ChangesList.php
Go to the documentation of this file.
1 <?php
26 
27 class ChangesList extends ContextSource {
31  public $skin;
32 
33  protected $watchlist = false;
34  protected $lastdate;
35  protected $message;
36  protected $rc_cache;
37  protected $rcCacheIndex;
38  protected $rclistOpen;
39  protected $rcMoveIndex;
40 
42  protected $watchMsgCache;
43 
47  protected $linkRenderer;
48 
54  public function __construct( $obj ) {
55  if ( $obj instanceof IContextSource ) {
56  $this->setContext( $obj );
57  $this->skin = $obj->getSkin();
58  } else {
59  $this->setContext( $obj->getContext() );
60  $this->skin = $obj;
61  }
62  $this->preCacheMessages();
63  $this->watchMsgCache = new HashBagOStuff( [ 'maxKeys' => 50 ] );
64  $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
65  }
66 
74  public static function newFromContext( IContextSource $context ) {
75  $user = $context->getUser();
76  $sk = $context->getSkin();
77  $list = null;
78  if ( Hooks::run( 'FetchChangesList', [ $user, &$sk, &$list ] ) ) {
79  $new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
80 
81  return $new ? new EnhancedChangesList( $context ) : new OldChangesList( $context );
82  } else {
83  return $list;
84  }
85  }
86 
98  public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
99  throw new RuntimeException( 'recentChangesLine should be implemented' );
100  }
101 
106  public function setWatchlistDivs( $value = true ) {
107  $this->watchlist = $value;
108  }
109 
114  public function isWatchlist() {
115  return (bool)$this->watchlist;
116  }
117 
122  private function preCacheMessages() {
123  if ( !isset( $this->message ) ) {
124  foreach ( [
125  'cur', 'diff', 'hist', 'enhancedrc-history', 'last', 'blocklink', 'history',
126  'semicolon-separator', 'pipe-separator' ] as $msg
127  ) {
128  $this->message[$msg] = $this->msg( $msg )->escaped();
129  }
130  }
131  }
132 
139  public function recentChangesFlags( $flags, $nothing = '&#160;' ) {
140  $f = '';
141  foreach ( array_keys( $this->getConfig()->get( 'RecentChangesFlags' ) ) as $flag ) {
142  $f .= isset( $flags[$flag] ) && $flags[$flag]
143  ? self::flag( $flag, $this->getContext() )
144  : $nothing;
145  }
146 
147  return $f;
148  }
149 
158  protected function getHTMLClasses( $rc, $watched ) {
159  $classes = [];
160  $logType = $rc->mAttribs['rc_log_type'];
161 
162  if ( $logType ) {
163  $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-' . $logType );
164  } else {
165  $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' .
166  $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
167  }
168 
169  // Indicate watched status on the line to allow for more
170  // comprehensive styling.
171  $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched
172  ? 'mw-changeslist-line-watched'
173  : 'mw-changeslist-line-not-watched';
174 
175  return $classes;
176  }
177 
186  public static function flag( $flag, IContextSource $context = null ) {
187  static $map = [ 'minoredit' => 'minor', 'botedit' => 'bot' ];
188  static $flagInfos = null;
189 
190  if ( is_null( $flagInfos ) ) {
191  global $wgRecentChangesFlags;
192  $flagInfos = [];
193  foreach ( $wgRecentChangesFlags as $key => $value ) {
194  $flagInfos[$key]['letter'] = $value['letter'];
195  $flagInfos[$key]['title'] = $value['title'];
196  // Allow customized class name, fall back to flag name
197  $flagInfos[$key]['class'] = isset( $value['class'] ) ? $value['class'] : $key;
198  }
199  }
200 
202 
203  // Inconsistent naming, kepted for b/c
204  if ( isset( $map[$flag] ) ) {
205  $flag = $map[$flag];
206  }
207 
208  $info = $flagInfos[$flag];
209  return Html::element( 'abbr', [
210  'class' => $info['class'],
211  'title' => wfMessage( $info['title'] )->setContext( $context )->text(),
212  ], wfMessage( $info['letter'] )->setContext( $context )->text() );
213  }
214 
219  public function beginRecentChangesList() {
220  $this->rc_cache = [];
221  $this->rcMoveIndex = 0;
222  $this->rcCacheIndex = 0;
223  $this->lastdate = '';
224  $this->rclistOpen = false;
225  $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
226 
227  return '<div class="mw-changeslist">';
228  }
229 
233  public function initChangesListRows( $rows ) {
234  Hooks::run( 'ChangesListInitRows', [ $this, $rows ] );
235  }
236 
247  public static function showCharacterDifference( $old, $new, IContextSource $context = null ) {
248  if ( !$context ) {
250  }
251 
252  $new = (int)$new;
253  $old = (int)$old;
254  $szdiff = $new - $old;
255 
257  $config = $context->getConfig();
258  $code = $lang->getCode();
259  static $fastCharDiff = [];
260  if ( !isset( $fastCharDiff[$code] ) ) {
261  $fastCharDiff[$code] = $config->get( 'MiserMode' )
262  || $context->msg( 'rc-change-size' )->plain() === '$1';
263  }
264 
265  $formattedSize = $lang->formatNum( $szdiff );
266 
267  if ( !$fastCharDiff[$code] ) {
268  $formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text();
269  }
270 
271  if ( abs( $szdiff ) > abs( $config->get( 'RCChangedSizeThreshold' ) ) ) {
272  $tag = 'strong';
273  } else {
274  $tag = 'span';
275  }
276 
277  if ( $szdiff === 0 ) {
278  $formattedSizeClass = 'mw-plusminus-null';
279  } elseif ( $szdiff > 0 ) {
280  $formattedSize = '+' . $formattedSize;
281  $formattedSizeClass = 'mw-plusminus-pos';
282  } else {
283  $formattedSizeClass = 'mw-plusminus-neg';
284  }
285 
286  $formattedTotalSize = $context->msg( 'rc-change-size-new' )->numParams( $new )->text();
287 
288  return Html::element( $tag,
289  [ 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ],
290  $context->msg( 'parentheses', $formattedSize )->plain() ) . $lang->getDirMark();
291  }
292 
300  public function formatCharacterDifference( RecentChange $old, RecentChange $new = null ) {
301  $oldlen = $old->mAttribs['rc_old_len'];
302 
303  if ( $new ) {
304  $newlen = $new->mAttribs['rc_new_len'];
305  } else {
306  $newlen = $old->mAttribs['rc_new_len'];
307  }
308 
309  if ( $oldlen === null || $newlen === null ) {
310  return '';
311  }
312 
313  return self::showCharacterDifference( $oldlen, $newlen, $this->getContext() );
314  }
315 
320  public function endRecentChangesList() {
321  $out = $this->rclistOpen ? "</ul>\n" : '';
322  $out .= '</div>';
323 
324  return $out;
325  }
326 
331  public function insertDateHeader( &$s, $rc_timestamp ) {
332  # Make date header if necessary
333  $date = $this->getLanguage()->userDate( $rc_timestamp, $this->getUser() );
334  if ( $date != $this->lastdate ) {
335  if ( $this->lastdate != '' ) {
336  $s .= "</ul>\n";
337  }
338  $s .= Xml::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
339  $this->lastdate = $date;
340  $this->rclistOpen = true;
341  }
342  }
343 
349  public function insertLog( &$s, $title, $logtype ) {
350  $page = new LogPage( $logtype );
351  $logname = $page->getName()->setContext( $this->getContext() )->text();
352  $s .= $this->msg( 'parentheses' )->rawParams(
353  $this->linkRenderer->makeKnownLink( $title, $logname )
354  )->escaped();
355  }
356 
362  public function insertDiffHist( &$s, &$rc, $unpatrolled = null ) {
363  # Diff link
364  if (
365  $rc->mAttribs['rc_type'] == RC_NEW ||
366  $rc->mAttribs['rc_type'] == RC_LOG ||
367  $rc->mAttribs['rc_type'] == RC_CATEGORIZE
368  ) {
369  $diffLink = $this->message['diff'];
370  } elseif ( !self::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
371  $diffLink = $this->message['diff'];
372  } else {
373  $query = [
374  'curid' => $rc->mAttribs['rc_cur_id'],
375  'diff' => $rc->mAttribs['rc_this_oldid'],
376  'oldid' => $rc->mAttribs['rc_last_oldid']
377  ];
378 
379  $diffLink = $this->linkRenderer->makeKnownLink(
380  $rc->getTitle(),
381  new HtmlArmor( $this->message['diff'] ),
382  [],
383  $query
384  );
385  }
386  if ( $rc->mAttribs['rc_type'] == RC_CATEGORIZE ) {
387  $diffhist = $diffLink . $this->message['pipe-separator'] . $this->message['hist'];
388  } else {
389  $diffhist = $diffLink . $this->message['pipe-separator'];
390  # History link
391  $diffhist .= $this->linkRenderer->makeKnownLink(
392  $rc->getTitle(),
393  new HtmlArmor( $this->message['hist'] ),
394  [],
395  [
396  'curid' => $rc->mAttribs['rc_cur_id'],
397  'action' => 'history'
398  ]
399  );
400  }
401 
402  // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
403  $s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() .
404  ' <span class="mw-changeslist-separator">. .</span> ';
405  }
406 
414  public function insertArticleLink( &$s, RecentChange $rc, $unpatrolled, $watched ) {
415  $s .= $this->getArticleLink( $rc, $unpatrolled, $watched );
416  }
417 
425  public function getArticleLink( &$rc, $unpatrolled, $watched ) {
426  $params = [];
427  if ( $rc->getTitle()->isRedirect() ) {
428  $params = [ 'redirect' => 'no' ];
429  }
430 
431  $articlelink = $this->linkRenderer->makeLink(
432  $rc->getTitle(),
433  null,
434  [ 'class' => 'mw-changeslist-title' ],
435  $params
436  );
437  if ( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) {
438  $articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
439  }
440  # To allow for boldening pages watched by this user
441  $articlelink = "<span class=\"mw-title\">{$articlelink}</span>";
442  # RTL/LTR marker
443  $articlelink .= $this->getLanguage()->getDirMark();
444 
445  # TODO: Deprecate the $s argument, it seems happily unused.
446  $s = '';
447  # Avoid PHP 7.1 warning from passing $this by reference
448  $changesList = $this;
449  Hooks::run( 'ChangesListInsertArticleLink',
450  [ &$changesList, &$articlelink, &$s, &$rc, $unpatrolled, $watched ] );
451 
452  return "{$s} {$articlelink}";
453  }
454 
462  public function getTimestamp( $rc ) {
463  // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
464  return $this->message['semicolon-separator'] . '<span class="mw-changeslist-date">' .
465  $this->getLanguage()->userTime(
466  $rc->mAttribs['rc_timestamp'],
467  $this->getUser()
468  ) . '</span> <span class="mw-changeslist-separator">. .</span> ';
469  }
470 
477  public function insertTimestamp( &$s, $rc ) {
478  $s .= $this->getTimestamp( $rc );
479  }
480 
487  public function insertUserRelatedLinks( &$s, &$rc ) {
488  if ( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
489  $s .= ' <span class="history-deleted">' .
490  $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
491  } else {
492  $s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
493  $rc->mAttribs['rc_user_text'] );
494  $s .= Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
495  }
496  }
497 
504  public function insertLogEntry( $rc ) {
505  $formatter = LogFormatter::newFromRow( $rc->mAttribs );
506  $formatter->setContext( $this->getContext() );
507  $formatter->setShowUserToolLinks( true );
508  $mark = $this->getLanguage()->getDirMark();
509 
510  return $formatter->getActionText() . " $mark" . $formatter->getComment();
511  }
512 
518  public function insertComment( $rc ) {
519  if ( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
520  return ' <span class="history-deleted">' .
521  $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
522  } else {
523  return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
524  }
525  }
526 
532  protected function numberofWatchingusers( $count ) {
533  if ( $count <= 0 ) {
534  return '';
535  }
537  return $cache->getWithSetCallback( $count, $cache::TTL_INDEFINITE,
538  function () use ( $count ) {
539  return $this->msg( 'number_of_watching_users_RCview' )
540  ->numParams( $count )->escaped();
541  }
542  );
543  }
544 
551  public static function isDeleted( $rc, $field ) {
552  return ( $rc->mAttribs['rc_deleted'] & $field ) == $field;
553  }
554 
563  public static function userCan( $rc, $field, User $user = null ) {
564  if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
565  return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
566  } else {
567  return Revision::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
568  }
569  }
570 
576  protected function maybeWatchedLink( $link, $watched = false ) {
577  if ( $watched ) {
578  return '<strong class="mw-watched">' . $link . '</strong>';
579  } else {
580  return '<span class="mw-rc-unwatched">' . $link . '</span>';
581  }
582  }
583 
589  public function insertRollback( &$s, &$rc ) {
590  if ( $rc->mAttribs['rc_type'] == RC_EDIT
591  && $rc->mAttribs['rc_this_oldid']
592  && $rc->mAttribs['rc_cur_id']
593  ) {
594  $page = $rc->getTitle();
597  if ( $this->getUser()->isAllowed( 'rollback' )
598  && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid']
599  ) {
600  $rev = new Revision( [
601  'title' => $page,
602  'id' => $rc->mAttribs['rc_this_oldid'],
603  'user' => $rc->mAttribs['rc_user'],
604  'user_text' => $rc->mAttribs['rc_user_text'],
605  'deleted' => $rc->mAttribs['rc_deleted']
606  ] );
607  $s .= ' ' . Linker::generateRollback( $rev, $this->getContext() );
608  }
609  }
610  }
611 
617  public function getRollback( RecentChange $rc ) {
618  $s = '';
619  $this->insertRollback( $s, $rc );
620  return $s;
621  }
622 
628  public function insertTags( &$s, &$rc, &$classes ) {
629  if ( empty( $rc->mAttribs['ts_tags'] ) ) {
630  return;
631  }
632 
633  list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
634  $rc->mAttribs['ts_tags'],
635  'changeslist',
636  $this->getContext()
637  );
638  $classes = array_merge( $classes, $newClasses );
639  $s .= ' ' . $tagSummary;
640  }
641 
648  public function getTags( RecentChange $rc, array &$classes ) {
649  $s = '';
650  $this->insertTags( $s, $rc, $classes );
651  return $s;
652  }
653 
654  public function insertExtra( &$s, &$rc, &$classes ) {
655  // Empty, used for subclasses to add anything special.
656  }
657 
658  protected function showAsUnpatrolled( RecentChange $rc ) {
659  return self::isUnpatrolled( $rc, $this->getUser() );
660  }
661 
667  public static function isUnpatrolled( $rc, User $user ) {
668  if ( $rc instanceof RecentChange ) {
669  $isPatrolled = $rc->mAttribs['rc_patrolled'];
670  $rcType = $rc->mAttribs['rc_type'];
671  $rcLogType = $rc->mAttribs['rc_log_type'];
672  } else {
673  $isPatrolled = $rc->rc_patrolled;
674  $rcType = $rc->rc_type;
675  $rcLogType = $rc->rc_log_type;
676  }
677 
678  if ( !$isPatrolled ) {
679  if ( $user->useRCPatrol() ) {
680  return true;
681  }
682  if ( $user->useNPPatrol() && $rcType == RC_NEW ) {
683  return true;
684  }
685  if ( $user->useFilePatrol() && $rcLogType == 'upload' ) {
686  return true;
687  }
688  }
689 
690  return false;
691  }
692 
702  protected function isCategorizationWithoutRevision( $rcObj ) {
703  return intval( $rcObj->getAttribute( 'rc_type' ) ) === RC_CATEGORIZE
704  && intval( $rcObj->getAttribute( 'rc_this_oldid' ) ) === 0;
705  }
706 
707 }
static newFromContext(IContextSource $context)
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
Definition: ChangesList.php:74
setContext(IContextSource $context)
Set the IContextSource object.
const RC_CATEGORIZE
Definition: Defines.php:140
Utility class for creating new RC entries.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
Interface for objects which can provide a MediaWiki context on request.
insertLog(&$s, $title, $logtype)
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition: hooks.txt:806
static userCan($rc, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted.
the array() calling protocol came about after MediaWiki 1.4rc1.
static newFromRow($row)
Handy shortcut for constructing a formatter directly from database row.
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1559
getLanguage()
Get the Language object.
BagOStuff $watchMsgCache
Definition: ChangesList.php:42
endRecentChangesList()
Returns text for the end of RC.
static element($element, $attribs=null, $contents= '', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:39
insertExtra(&$s, &$rc, &$classes)
insertRollback(&$s, &$rc)
Inserts a rollback link.
recentChangesFlags($flags, $nothing= '&#160;')
Returns the appropriate flags for new page, minor change and patrolling.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static isDeleted($rc, $field)
Determine if said field of a revision is hidden.
initChangesListRows($rows)
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg()
Get a Message object with context set.
if(!isset($args[0])) $lang
getTags(RecentChange $rc, array &$classes)
$value
numberofWatchingusers($count)
Returns the string which indicates the number of watching users.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2707
formatCharacterDifference(RecentChange $old, RecentChange $new=null)
Format the character difference of one or several changes.
static escapeClass($class)
Given a value, escape it so that it can be used as a CSS class and return it.
Definition: Sanitizer.php:1247
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
__construct($obj)
Changeslist constructor.
Definition: ChangesList.php:54
IContextSource $context
insertDateHeader(&$s, $rc_timestamp)
Class to simplify the use of log pages.
Definition: LogPage.php:32
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition: hooks.txt:2893
getUser()
Get the User object.
msg()
Get a Message object with context set Parameters are the same as wfMessage()
getConfig()
Get the site configuration.
insertUserRelatedLinks(&$s, &$rc)
Insert links to user page, user talk page and eventually a blocking link.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a message
Definition: hooks.txt:2098
static getMain()
Static methods.
static formatSummaryRow($tags, $page, IContextSource $context=null)
Creates HTML for the given tags.
Definition: ChangeTags.php:50
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock()-offset Set to overwrite offset parameter in $wgRequest set to ''to unsetoffset-wrap String Wrap the message in html(usually something like"&lt
getConfig()
Get the Config object.
getRollback(RecentChange $rc)
getArticleLink(&$rc, $unpatrolled, $watched)
static showCharacterDifference($old, $new, IContextSource $context=null)
Show formatted char difference.
showAsUnpatrolled(RecentChange $rc)
getContext()
Get the base IContextSource object.
$cache
Definition: mcc.php:33
$params
getTimestamp($rc)
Get the timestamp from $rc formatted with current user's settings and a separator.
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:957
isCategorizationWithoutRevision($rcObj)
Determines whether a revision is linked to this change; this may not be the case when the categorizat...
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books $tag
Definition: hooks.txt:1011
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
Definition: hooks.txt:1725
getLanguage()
Get the Language object.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
insertTimestamp(&$s, $rc)
Insert time timestamp string from $rc into $s.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
Definition: hooks.txt:806
insertTags(&$s, &$rc, &$classes)
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition: hooks.txt:246
useRCPatrol()
Check whether to enable recent changes patrol features for this user.
Definition: User.php:3456
const DELETED_TEXT
Definition: Revision.php:85
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often...
insertArticleLink(&$s, RecentChange $rc, $unpatrolled, $watched)
static userLink($userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
Definition: Linker.php:984
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges $changesList
Definition: hooks.txt:1446
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
const DELETED_USER
Definition: Revision.php:87
beginRecentChangesList()
Returns text for the start of the tabular part of RC.
useFilePatrol()
Check whether to enable new files patrol features for this user.
Definition: User.php:3477
getSkin()
Get the Skin object.
static generateRollback($rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
Definition: Linker.php:1763
static userCanBitfield($bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row, if it's marked as deleted.
static userToolLinks($userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
Definition: Linker.php:1017
useNPPatrol()
Check whether to enable new pages patrol features for this user.
Definition: User.php:3465
static flag($flag, IContextSource $context=null)
Make an "" element for a given change flag.
insertLogEntry($rc)
Insert a formatted action.
$count
LinkRenderer $linkRenderer
Definition: ChangesList.php:47
setWatchlistDivs($value=true)
Sets the list to use a "
  • " tag.
  • const RC_NEW
    Definition: Defines.php:137
    static userCanBitfield($bitfield, $field, User $user=null, Title $title=null)
    Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted.
    Definition: Revision.php:1764
    const DELETED_COMMENT
    Definition: Revision.php:86
    static commentBlock($comment, $title=null, $local=false, $wikiId=null)
    Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
    Definition: Linker.php:1525
    static isUnpatrolled($rc, User $user)
    insertComment($rc)
    Insert a formatted comment.
    recentChangesLine(&$rc, $watched=false, $linenumber=null)
    Format a line.
    Definition: ChangesList.php:98
    getHTMLClasses($rc, $watched)
    Get an array of default HTML class attributes for the change.
    insertDiffHist(&$s, &$rc, $unpatrolled=null)
    static element($element, $attribs=[], $contents= '')
    Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
    Definition: Html.php:229
    getUser()
    Get the User object.
    getRequest()
    Get the WebRequest object.
    this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a skin(according to that user's preference)
    maybeWatchedLink($link, $watched=false)
    const RC_EDIT
    Definition: Defines.php:136
    do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
    Definition: hooks.txt:2495
    const RC_LOG
    Definition: Defines.php:138
    getOutput()
    Get the OutputPage object.
    getSkin()
    Get the Skin object.