MediaWiki  1.29.1
ChangesList.php
Go to the documentation of this file.
1 <?php
27 
28 class ChangesList extends ContextSource {
29  const CSS_CLASS_PREFIX = 'mw-changeslist-';
30 
34  public $skin;
35 
36  protected $watchlist = false;
37  protected $lastdate;
38  protected $message;
39  protected $rc_cache;
40  protected $rcCacheIndex;
41  protected $rclistOpen;
42  protected $rcMoveIndex;
43 
45  protected $watchMsgCache;
46 
50  protected $linkRenderer;
51 
55  protected $filterGroups;
56 
63  public function __construct( $obj, array $filterGroups = [] ) {
64  if ( $obj instanceof IContextSource ) {
65  $this->setContext( $obj );
66  $this->skin = $obj->getSkin();
67  } else {
68  $this->setContext( $obj->getContext() );
69  $this->skin = $obj;
70  }
71  $this->preCacheMessages();
72  $this->watchMsgCache = new HashBagOStuff( [ 'maxKeys' => 50 ] );
73  $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
74  $this->filterGroups = $filterGroups;
75  }
76 
85  public static function newFromContext( IContextSource $context, array $groups = [] ) {
86  $user = $context->getUser();
87  $sk = $context->getSkin();
88  $list = null;
89  if ( Hooks::run( 'FetchChangesList', [ $user, &$sk, &$list ] ) ) {
90  $new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
91 
92  return $new ?
93  new EnhancedChangesList( $context, $groups ) :
94  new OldChangesList( $context, $groups );
95  } else {
96  return $list;
97  }
98  }
99 
111  public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
112  throw new RuntimeException( 'recentChangesLine should be implemented' );
113  }
114 
119  public function setWatchlistDivs( $value = true ) {
120  $this->watchlist = $value;
121  }
122 
127  public function isWatchlist() {
128  return (bool)$this->watchlist;
129  }
130 
135  private function preCacheMessages() {
136  if ( !isset( $this->message ) ) {
137  foreach ( [
138  'cur', 'diff', 'hist', 'enhancedrc-history', 'last', 'blocklink', 'history',
139  'semicolon-separator', 'pipe-separator' ] as $msg
140  ) {
141  $this->message[$msg] = $this->msg( $msg )->escaped();
142  }
143  }
144  }
145 
152  public function recentChangesFlags( $flags, $nothing = '&#160;' ) {
153  $f = '';
154  foreach ( array_keys( $this->getConfig()->get( 'RecentChangesFlags' ) ) as $flag ) {
155  $f .= isset( $flags[$flag] ) && $flags[$flag]
156  ? self::flag( $flag, $this->getContext() )
157  : $nothing;
158  }
159 
160  return $f;
161  }
162 
171  protected function getHTMLClasses( $rc, $watched ) {
172  $classes = [];
173  $logType = $rc->mAttribs['rc_log_type'];
174 
175  if ( $logType ) {
176  $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'log-' . $logType );
177  } else {
178  $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns' .
179  $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
180  }
181 
182  // Indicate watched status on the line to allow for more
183  // comprehensive styling.
184  $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched
185  ? self::CSS_CLASS_PREFIX . 'line-watched'
186  : self::CSS_CLASS_PREFIX . 'line-not-watched';
187 
188  $classes = array_merge( $classes, $this->getHTMLClassesForFilters( $rc ) );
189 
190  return $classes;
191  }
192 
199  protected function getHTMLClassesForFilters( $rc ) {
200  $classes = [];
201 
202  if ( $this->filterGroups !== null ) {
203  foreach ( $this->filterGroups as $filterGroup ) {
204  foreach ( $filterGroup->getFilters() as $filter ) {
205  $filter->applyCssClassIfNeeded( $this, $rc, $classes );
206  }
207  }
208  }
209 
210  return $classes;
211  }
212 
221  public static function flag( $flag, IContextSource $context = null ) {
222  static $map = [ 'minoredit' => 'minor', 'botedit' => 'bot' ];
223  static $flagInfos = null;
224 
225  if ( is_null( $flagInfos ) ) {
226  global $wgRecentChangesFlags;
227  $flagInfos = [];
228  foreach ( $wgRecentChangesFlags as $key => $value ) {
229  $flagInfos[$key]['letter'] = $value['letter'];
230  $flagInfos[$key]['title'] = $value['title'];
231  // Allow customized class name, fall back to flag name
232  $flagInfos[$key]['class'] = isset( $value['class'] ) ? $value['class'] : $key;
233  }
234  }
235 
237 
238  // Inconsistent naming, kepted for b/c
239  if ( isset( $map[$flag] ) ) {
240  $flag = $map[$flag];
241  }
242 
243  $info = $flagInfos[$flag];
244  return Html::element( 'abbr', [
245  'class' => $info['class'],
246  'title' => wfMessage( $info['title'] )->setContext( $context )->text(),
247  ], wfMessage( $info['letter'] )->setContext( $context )->text() );
248  }
249 
254  public function beginRecentChangesList() {
255  $this->rc_cache = [];
256  $this->rcMoveIndex = 0;
257  $this->rcCacheIndex = 0;
258  $this->lastdate = '';
259  $this->rclistOpen = false;
260  $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
261 
262  return '<div class="mw-changeslist">';
263  }
264 
268  public function initChangesListRows( $rows ) {
269  Hooks::run( 'ChangesListInitRows', [ $this, $rows ] );
270  }
271 
282  public static function showCharacterDifference( $old, $new, IContextSource $context = null ) {
283  if ( !$context ) {
285  }
286 
287  $new = (int)$new;
288  $old = (int)$old;
289  $szdiff = $new - $old;
290 
292  $config = $context->getConfig();
293  $code = $lang->getCode();
294  static $fastCharDiff = [];
295  if ( !isset( $fastCharDiff[$code] ) ) {
296  $fastCharDiff[$code] = $config->get( 'MiserMode' )
297  || $context->msg( 'rc-change-size' )->plain() === '$1';
298  }
299 
300  $formattedSize = $lang->formatNum( $szdiff );
301 
302  if ( !$fastCharDiff[$code] ) {
303  $formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text();
304  }
305 
306  if ( abs( $szdiff ) > abs( $config->get( 'RCChangedSizeThreshold' ) ) ) {
307  $tag = 'strong';
308  } else {
309  $tag = 'span';
310  }
311 
312  if ( $szdiff === 0 ) {
313  $formattedSizeClass = 'mw-plusminus-null';
314  } elseif ( $szdiff > 0 ) {
315  $formattedSize = '+' . $formattedSize;
316  $formattedSizeClass = 'mw-plusminus-pos';
317  } else {
318  $formattedSizeClass = 'mw-plusminus-neg';
319  }
320 
321  $formattedTotalSize = $context->msg( 'rc-change-size-new' )->numParams( $new )->text();
322 
323  return Html::element( $tag,
324  [ 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ],
325  $context->msg( 'parentheses', $formattedSize )->plain() ) . $lang->getDirMark();
326  }
327 
335  public function formatCharacterDifference( RecentChange $old, RecentChange $new = null ) {
336  $oldlen = $old->mAttribs['rc_old_len'];
337 
338  if ( $new ) {
339  $newlen = $new->mAttribs['rc_new_len'];
340  } else {
341  $newlen = $old->mAttribs['rc_new_len'];
342  }
343 
344  if ( $oldlen === null || $newlen === null ) {
345  return '';
346  }
347 
348  return self::showCharacterDifference( $oldlen, $newlen, $this->getContext() );
349  }
350 
355  public function endRecentChangesList() {
356  $out = $this->rclistOpen ? "</ul>\n" : '';
357  $out .= '</div>';
358 
359  return $out;
360  }
361 
366  public function insertDateHeader( &$s, $rc_timestamp ) {
367  # Make date header if necessary
368  $date = $this->getLanguage()->userDate( $rc_timestamp, $this->getUser() );
369  if ( $date != $this->lastdate ) {
370  if ( $this->lastdate != '' ) {
371  $s .= "</ul>\n";
372  }
373  $s .= Xml::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
374  $this->lastdate = $date;
375  $this->rclistOpen = true;
376  }
377  }
378 
384  public function insertLog( &$s, $title, $logtype ) {
385  $page = new LogPage( $logtype );
386  $logname = $page->getName()->setContext( $this->getContext() )->text();
387  $s .= $this->msg( 'parentheses' )->rawParams(
388  $this->linkRenderer->makeKnownLink( $title, $logname )
389  )->escaped();
390  }
391 
397  public function insertDiffHist( &$s, &$rc, $unpatrolled = null ) {
398  # Diff link
399  if (
400  $rc->mAttribs['rc_type'] == RC_NEW ||
401  $rc->mAttribs['rc_type'] == RC_LOG ||
402  $rc->mAttribs['rc_type'] == RC_CATEGORIZE
403  ) {
404  $diffLink = $this->message['diff'];
405  } elseif ( !self::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
406  $diffLink = $this->message['diff'];
407  } else {
408  $query = [
409  'curid' => $rc->mAttribs['rc_cur_id'],
410  'diff' => $rc->mAttribs['rc_this_oldid'],
411  'oldid' => $rc->mAttribs['rc_last_oldid']
412  ];
413 
414  $diffLink = $this->linkRenderer->makeKnownLink(
415  $rc->getTitle(),
416  new HtmlArmor( $this->message['diff'] ),
417  [ 'class' => 'mw-changeslist-diff' ],
418  $query
419  );
420  }
421  if ( $rc->mAttribs['rc_type'] == RC_CATEGORIZE ) {
422  $diffhist = $diffLink . $this->message['pipe-separator'] . $this->message['hist'];
423  } else {
424  $diffhist = $diffLink . $this->message['pipe-separator'];
425  # History link
426  $diffhist .= $this->linkRenderer->makeKnownLink(
427  $rc->getTitle(),
428  new HtmlArmor( $this->message['hist'] ),
429  [ 'class' => 'mw-changeslist-history' ],
430  [
431  'curid' => $rc->mAttribs['rc_cur_id'],
432  'action' => 'history'
433  ]
434  );
435  }
436 
437  // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
438  $s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() .
439  ' <span class="mw-changeslist-separator">. .</span> ';
440  }
441 
449  public function insertArticleLink( &$s, RecentChange $rc, $unpatrolled, $watched ) {
450  $s .= $this->getArticleLink( $rc, $unpatrolled, $watched );
451  }
452 
460  public function getArticleLink( &$rc, $unpatrolled, $watched ) {
461  $params = [];
462  if ( $rc->getTitle()->isRedirect() ) {
463  $params = [ 'redirect' => 'no' ];
464  }
465 
466  $articlelink = $this->linkRenderer->makeLink(
467  $rc->getTitle(),
468  null,
469  [ 'class' => 'mw-changeslist-title' ],
470  $params
471  );
472  if ( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) {
473  $articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
474  }
475  # To allow for boldening pages watched by this user
476  $articlelink = "<span class=\"mw-title\">{$articlelink}</span>";
477  # RTL/LTR marker
478  $articlelink .= $this->getLanguage()->getDirMark();
479 
480  # TODO: Deprecate the $s argument, it seems happily unused.
481  $s = '';
482  # Avoid PHP 7.1 warning from passing $this by reference
483  $changesList = $this;
484  Hooks::run( 'ChangesListInsertArticleLink',
485  [ &$changesList, &$articlelink, &$s, &$rc, $unpatrolled, $watched ] );
486 
487  return "{$s} {$articlelink}";
488  }
489 
497  public function getTimestamp( $rc ) {
498  // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
499  return $this->message['semicolon-separator'] . '<span class="mw-changeslist-date">' .
500  $this->getLanguage()->userTime(
501  $rc->mAttribs['rc_timestamp'],
502  $this->getUser()
503  ) . '</span> <span class="mw-changeslist-separator">. .</span> ';
504  }
505 
512  public function insertTimestamp( &$s, $rc ) {
513  $s .= $this->getTimestamp( $rc );
514  }
515 
522  public function insertUserRelatedLinks( &$s, &$rc ) {
523  if ( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
524  $s .= ' <span class="history-deleted">' .
525  $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
526  } else {
527  $s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
528  $rc->mAttribs['rc_user_text'] );
529  $s .= Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
530  }
531  }
532 
539  public function insertLogEntry( $rc ) {
540  $formatter = LogFormatter::newFromRow( $rc->mAttribs );
541  $formatter->setContext( $this->getContext() );
542  $formatter->setShowUserToolLinks( true );
543  $mark = $this->getLanguage()->getDirMark();
544 
545  return $formatter->getActionText() . " $mark" . $formatter->getComment();
546  }
547 
553  public function insertComment( $rc ) {
554  if ( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
555  return ' <span class="history-deleted">' .
556  $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
557  } else {
558  return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
559  }
560  }
561 
567  protected function numberofWatchingusers( $count ) {
568  if ( $count <= 0 ) {
569  return '';
570  }
572  return $cache->getWithSetCallback( $count, $cache::TTL_INDEFINITE,
573  function () use ( $count ) {
574  return $this->msg( 'number_of_watching_users_RCview' )
575  ->numParams( $count )->escaped();
576  }
577  );
578  }
579 
586  public static function isDeleted( $rc, $field ) {
587  return ( $rc->mAttribs['rc_deleted'] & $field ) == $field;
588  }
589 
598  public static function userCan( $rc, $field, User $user = null ) {
599  if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
600  return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
601  } else {
602  return Revision::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
603  }
604  }
605 
611  protected function maybeWatchedLink( $link, $watched = false ) {
612  if ( $watched ) {
613  return '<strong class="mw-watched">' . $link . '</strong>';
614  } else {
615  return '<span class="mw-rc-unwatched">' . $link . '</span>';
616  }
617  }
618 
624  public function insertRollback( &$s, &$rc ) {
625  if ( $rc->mAttribs['rc_type'] == RC_EDIT
626  && $rc->mAttribs['rc_this_oldid']
627  && $rc->mAttribs['rc_cur_id']
628  ) {
629  $page = $rc->getTitle();
632  if ( $this->getUser()->isAllowed( 'rollback' )
633  && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid']
634  ) {
635  $rev = new Revision( [
636  'title' => $page,
637  'id' => $rc->mAttribs['rc_this_oldid'],
638  'user' => $rc->mAttribs['rc_user'],
639  'user_text' => $rc->mAttribs['rc_user_text'],
640  'deleted' => $rc->mAttribs['rc_deleted']
641  ] );
642  $s .= ' ' . Linker::generateRollback( $rev, $this->getContext() );
643  }
644  }
645  }
646 
652  public function getRollback( RecentChange $rc ) {
653  $s = '';
654  $this->insertRollback( $s, $rc );
655  return $s;
656  }
657 
663  public function insertTags( &$s, &$rc, &$classes ) {
664  if ( empty( $rc->mAttribs['ts_tags'] ) ) {
665  return;
666  }
667 
668  list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
669  $rc->mAttribs['ts_tags'],
670  'changeslist',
671  $this->getContext()
672  );
673  $classes = array_merge( $classes, $newClasses );
674  $s .= ' ' . $tagSummary;
675  }
676 
683  public function getTags( RecentChange $rc, array &$classes ) {
684  $s = '';
685  $this->insertTags( $s, $rc, $classes );
686  return $s;
687  }
688 
689  public function insertExtra( &$s, &$rc, &$classes ) {
690  // Empty, used for subclasses to add anything special.
691  }
692 
693  protected function showAsUnpatrolled( RecentChange $rc ) {
694  return self::isUnpatrolled( $rc, $this->getUser() );
695  }
696 
702  public static function isUnpatrolled( $rc, User $user ) {
703  if ( $rc instanceof RecentChange ) {
704  $isPatrolled = $rc->mAttribs['rc_patrolled'];
705  $rcType = $rc->mAttribs['rc_type'];
706  $rcLogType = $rc->mAttribs['rc_log_type'];
707  } else {
708  $isPatrolled = $rc->rc_patrolled;
709  $rcType = $rc->rc_type;
710  $rcLogType = $rc->rc_log_type;
711  }
712 
713  if ( !$isPatrolled ) {
714  if ( $user->useRCPatrol() ) {
715  return true;
716  }
717  if ( $user->useNPPatrol() && $rcType == RC_NEW ) {
718  return true;
719  }
720  if ( $user->useFilePatrol() && $rcLogType == 'upload' ) {
721  return true;
722  }
723  }
724 
725  return false;
726  }
727 
737  protected function isCategorizationWithoutRevision( $rcObj ) {
738  return intval( $rcObj->getAttribute( 'rc_type' ) ) === RC_CATEGORIZE
739  && intval( $rcObj->getAttribute( 'rc_this_oldid' ) ) === 0;
740  }
741 
742 }
Revision\DELETED_USER
const DELETED_USER
Definition: Revision.php:92
ChangesList\endRecentChangesList
endRecentChangesList()
Returns text for the end of RC.
Definition: ChangesList.php:355
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:34
ContextSource\getConfig
getConfig()
Get the Config object.
Definition: ContextSource.php:68
ContextSource\getContext
getContext()
Get the base IContextSource object.
Definition: ContextSource.php:41
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:28
ChangesList\insertComment
insertComment( $rc)
Insert a formatted comment.
Definition: ChangesList.php:553
ChangesList\setWatchlistDivs
setWatchlistDivs( $value=true)
Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag.
Definition: ChangesList.php:119
Revision\DELETED_COMMENT
const DELETED_COMMENT
Definition: Revision.php:91
HashBagOStuff
Simple store for keeping values in an associative array for the current process.
Definition: HashBagOStuff.php:31
ContextSource\msg
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:187
Revision\userCanBitfield
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,...
Definition: Revision.php:1779
IContextSource\getSkin
getSkin()
Get the Skin object.
Linker\userLink
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
Definition: Linker.php:888
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:33
ChangesList\$watchMsgCache
BagOStuff $watchMsgCache
Definition: ChangesList.php:45
text
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
RecentChange
Utility class for creating new RC entries.
Definition: RecentChange.php:63
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:42
ChangesList\maybeWatchedLink
maybeWatchedLink( $link, $watched=false)
Definition: ChangesList.php:611
RC_LOG
const RC_LOG
Definition: Defines.php:142
$changesList
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:1459
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
$user
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 account $user
Definition: hooks.txt:246
ChangesList\insertLog
insertLog(&$s, $title, $logtype)
Definition: ChangesList.php:384
ChangesList\getTags
getTags(RecentChange $rc, array &$classes)
Definition: ChangesList.php:683
$params
$params
Definition: styleTest.css.php:40
RC_EDIT
const RC_EDIT
Definition: Defines.php:140
IContextSource\msg
msg()
Get a Message object with context set.
BagOStuff
interface is intended to be more or less compatible with the PHP memcached client.
Definition: BagOStuff.php:47
$s
$s
Definition: mergeMessageFileList.php:188
ChangesList\$rcCacheIndex
$rcCacheIndex
Definition: ChangesList.php:40
Wikimedia\Rdbms\ResultWrapper
Result wrapper for grabbing data queried from an IDatabase object.
Definition: ResultWrapper.php:24
ChangesList\formatCharacterDifference
formatCharacterDifference(RecentChange $old, RecentChange $new=null)
Format the character difference of one or several changes.
Definition: ChangesList.php:335
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:133
ChangesList\$lastdate
$lastdate
Definition: ChangesList.php:37
ChangesList\isDeleted
static isDeleted( $rc, $field)
Determine if said field of a revision is hidden.
Definition: ChangesList.php:586
php
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
ContextSource\getLanguage
getLanguage()
Get the Language object.
Definition: ContextSource.php:143
Revision
Definition: Revision.php:33
ChangesList\insertDateHeader
insertDateHeader(&$s, $rc_timestamp)
Definition: ChangesList.php:366
ChangesList\$filterGroups
array $filterGroups
Definition: ChangesList.php:55
$query
null for the 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:1572
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:934
Linker\generateRollback
static generateRollback( $rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
Definition: Linker.php:1675
LogFormatter\newFromRow
static newFromRow( $row)
Handy shortcut for constructing a formatter directly from database row.
Definition: LogFormatter.php:74
ChangesList\insertLogEntry
insertLogEntry( $rc)
Insert a formatted action.
Definition: ChangesList.php:539
$page
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:2536
$tag
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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:1028
ContextSource\getOutput
getOutput()
Get the OutputPage object.
Definition: ContextSource.php:123
ContextSource
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
Definition: ContextSource.php:30
ChangesList\isWatchlist
isWatchlist()
Definition: ChangesList.php:127
ChangesList\insertTags
insertTags(&$s, &$rc, &$classes)
Definition: ChangesList.php:663
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:31
ContextSource\getSkin
getSkin()
Get the Skin object.
Definition: ContextSource.php:153
Xml\element
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:39
ChangesList\flag
static flag( $flag, IContextSource $context=null)
Make an "<abbr>" element for a given change flag.
Definition: ChangesList.php:221
ChangesList\CSS_CLASS_PREFIX
const CSS_CLASS_PREFIX
Definition: ChangesList.php:29
message
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:2114
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ChangesList\insertUserRelatedLinks
insertUserRelatedLinks(&$s, &$rc)
Insert links to user page, user talk page and eventually a blocking link.
Definition: ChangesList.php:522
ContextSource\setContext
setContext(IContextSource $context)
Set the IContextSource object.
Definition: ContextSource.php:58
list
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
ChangesList\getRollback
getRollback(RecentChange $rc)
Definition: ChangesList.php:652
ChangesList\getArticleLink
getArticleLink(&$rc, $unpatrolled, $watched)
Definition: ChangesList.php:460
ChangesList\newFromContext
static newFromContext(IContextSource $context, array $groups=[])
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
Definition: ChangesList.php:85
ChangesList\$rclistOpen
$rclistOpen
Definition: ChangesList.php:41
EnhancedChangesList
Definition: EnhancedChangesList.php:23
OldChangesList
Definition: OldChangesList.php:23
skin
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)
$value
$value
Definition: styleTest.css.php:45
Linker\userToolLinks
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null)
Generate standard user tool links (talk, contributions, block link, etc.)
Definition: Linker.php:921
ChangesList\insertTimestamp
insertTimestamp(&$s, $rc)
Insert time timestamp string from $rc into $s.
Definition: ChangesList.php:512
ChangesList\numberofWatchingusers
numberofWatchingusers( $count)
Returns the string which indicates the number of watching users.
Definition: ChangesList.php:567
ChangesList\showAsUnpatrolled
showAsUnpatrolled(RecentChange $rc)
Definition: ChangesList.php:693
ChangesList\showCharacterDifference
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
Definition: ChangesList.php:282
IContextSource\getUser
getUser()
Get the User object.
RC_NEW
const RC_NEW
Definition: Defines.php:141
ChangesList\preCacheMessages
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often,...
Definition: ChangesList.php:135
RequestContext\getMain
static getMain()
Static methods.
Definition: RequestContext.php:468
ChangesList\insertArticleLink
insertArticleLink(&$s, RecentChange $rc, $unpatrolled, $watched)
Definition: ChangesList.php:449
ChangesList\$watchlist
$watchlist
Definition: ChangesList.php:36
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:55
ChangesList\getHTMLClasses
getHTMLClasses( $rc, $watched)
Get an array of default HTML class attributes for the change.
Definition: ChangesList.php:171
ChangesList\__construct
__construct( $obj, array $filterGroups=[])
Changeslist constructor.
Definition: ChangesList.php:63
ChangesList\beginRecentChangesList
beginRecentChangesList()
Returns text for the start of the tabular part of RC.
Definition: ChangesList.php:254
$cache
$cache
Definition: mcc.php:33
ChangesList\insertDiffHist
insertDiffHist(&$s, &$rc, $unpatrolled=null)
Definition: ChangesList.php:397
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:512
ChangesList\initChangesListRows
initChangesListRows( $rows)
Definition: ChangesList.php:268
$code
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:783
IContextSource\getConfig
getConfig()
Get the site configuration.
ChangesList\isCategorizationWithoutRevision
isCategorizationWithoutRevision( $rcObj)
Determines whether a revision is linked to this change; this may not be the case when the categorizat...
Definition: ChangesList.php:737
$rev
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:1741
as
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
ChangesList\recentChangesFlags
recentChangesFlags( $flags, $nothing='&#160;')
Returns the appropriate flags for new page, minor change and patrolling.
Definition: ChangesList.php:152
Linker\commentBlock
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:1439
$link
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition: hooks.txt:2929
ChangesList\getTimestamp
getTimestamp( $rc)
Get the timestamp from $rc formatted with current user's settings and a separator.
Definition: ChangesList.php:497
IContextSource\getRequest
getRequest()
Get the WebRequest object.
ChangesList
Definition: ChangesList.php:28
wfMessage
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 unset offset - wrap String Wrap the message in html(usually something like "&lt
ChangesList\$skin
Skin $skin
Definition: ChangesList.php:34
RC_CATEGORIZE
const RC_CATEGORIZE
Definition: Defines.php:144
ChangesList\isUnpatrolled
static isUnpatrolled( $rc, User $user)
Definition: ChangesList.php:702
ChangesList\$rc_cache
$rc_cache
Definition: ChangesList.php:39
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:231
MediaWikiServices
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
ChangesList\$rcMoveIndex
$rcMoveIndex
Definition: ChangesList.php:42
Skin
The main skin class which provides methods and properties for all other skins.
Definition: Skin.php:34
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:50
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
ChangesList\$message
$message
Definition: ChangesList.php:38
ChangeTags\formatSummaryRow
static formatSummaryRow( $tags, $page, IContextSource $context=null)
Creates HTML for the given tags.
Definition: ChangeTags.php:52
Revision\DELETED_TEXT
const DELETED_TEXT
Definition: Revision.php:90
ChangesList\getHTMLClassesForFilters
getHTMLClassesForFilters( $rc)
Get an array of CSS classes attributed to filters for this row.
Definition: ChangesList.php:199
ChangesList\recentChangesLine
recentChangesLine(&$rc, $watched=false, $linenumber=null)
Format a line.
Definition: ChangesList.php:111
ChangesList\userCan
static userCan( $rc, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
Definition: ChangesList.php:598
ChangesList\insertExtra
insertExtra(&$s, &$rc, &$classes)
Definition: ChangesList.php:689
ChangesList\insertRollback
insertRollback(&$s, &$rc)
Inserts a rollback link.
Definition: ChangesList.php:624
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2749
IContextSource\getLanguage
getLanguage()
Get the Language object.
array
the array() calling protocol came about after MediaWiki 1.4rc1.
ChangesList\$linkRenderer
LinkRenderer $linkRenderer
Definition: ChangesList.php:50
$out
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:783