MediaWiki  master
ChangesList.php
Go to the documentation of this file.
1 <?php
28 
29 class ChangesList extends ContextSource {
30  const CSS_CLASS_PREFIX = 'mw-changeslist-';
31 
35  public $skin;
36 
37  protected $watchlist = false;
38  protected $lastdate;
39  protected $message;
40  protected $rc_cache;
41  protected $rcCacheIndex;
42  protected $rclistOpen;
43  protected $rcMoveIndex;
44 
47 
49  protected $watchMsgCache;
50 
54  protected $linkRenderer;
55 
59  protected $filterGroups;
60 
65  public function __construct( $obj, array $filterGroups = [] ) {
66  if ( $obj instanceof IContextSource ) {
67  $this->setContext( $obj );
68  $this->skin = $obj->getSkin();
69  } else {
70  $this->setContext( $obj->getContext() );
71  $this->skin = $obj;
72  }
73  $this->preCacheMessages();
74  $this->watchMsgCache = new MapCacheLRU( 50 );
75  $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
76  $this->filterGroups = $filterGroups;
77  }
78 
87  public static function newFromContext( IContextSource $context, array $groups = [] ) {
88  $user = $context->getUser();
89  $sk = $context->getSkin();
90  $list = null;
91  if ( Hooks::run( 'FetchChangesList', [ $user, &$sk, &$list, $groups ] ) ) {
92  $new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
93 
94  return $new ?
95  new EnhancedChangesList( $context, $groups ) :
96  new OldChangesList( $context, $groups );
97  } else {
98  return $list;
99  }
100  }
101 
113  public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
114  throw new RuntimeException( 'recentChangesLine should be implemented' );
115  }
116 
123  protected function getHighlightsContainerDiv() {
124  $highlightColorDivs = '';
125  foreach ( [ 'none', 'c1', 'c2', 'c3', 'c4', 'c5' ] as $color ) {
126  $highlightColorDivs .= Html::rawElement(
127  'div',
128  [
129  'class' => 'mw-rcfilters-ui-highlights-color-' . $color,
130  'data-color' => $color
131  ]
132  );
133  }
134 
135  return Html::rawElement(
136  'div',
137  [ 'class' => 'mw-rcfilters-ui-highlights' ],
138  $highlightColorDivs
139  );
140  }
141 
146  public function setWatchlistDivs( $value = true ) {
147  $this->watchlist = $value;
148  }
149 
154  public function isWatchlist() {
155  return (bool)$this->watchlist;
156  }
157 
162  private function preCacheMessages() {
163  if ( !isset( $this->message ) ) {
164  $this->message = [];
165  foreach ( [
166  'cur', 'diff', 'hist', 'enhancedrc-history', 'last', 'blocklink', 'history',
167  'semicolon-separator', 'pipe-separator' ] as $msg
168  ) {
169  $this->message[$msg] = $this->msg( $msg )->escaped();
170  }
171  }
172  }
173 
180  public function recentChangesFlags( $flags, $nothing = "\u{00A0}" ) {
181  $f = '';
182  foreach ( array_keys( $this->getConfig()->get( 'RecentChangesFlags' ) ) as $flag ) {
183  $f .= isset( $flags[$flag] ) && $flags[$flag]
184  ? self::flag( $flag, $this->getContext() )
185  : $nothing;
186  }
187 
188  return $f;
189  }
190 
199  protected function getHTMLClasses( $rc, $watched ) {
200  $classes = [ self::CSS_CLASS_PREFIX . 'line' ];
201  $logType = $rc->mAttribs['rc_log_type'];
202 
203  if ( $logType ) {
204  $classes[] = self::CSS_CLASS_PREFIX . 'log';
205  $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'log-' . $logType );
206  } else {
207  $classes[] = self::CSS_CLASS_PREFIX . 'edit';
208  $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns' .
209  $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
210  }
211 
212  // Indicate watched status on the line to allow for more
213  // comprehensive styling.
214  $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched
215  ? self::CSS_CLASS_PREFIX . 'line-watched'
216  : self::CSS_CLASS_PREFIX . 'line-not-watched';
217 
218  $classes = array_merge( $classes, $this->getHTMLClassesForFilters( $rc ) );
219 
220  return $classes;
221  }
222 
230  protected function getHTMLClassesForFilters( $rc ) {
231  $classes = [];
232 
233  $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns-' .
234  $rc->mAttribs['rc_namespace'] );
235 
236  $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
237  $classes[] = Sanitizer::escapeClass(
238  self::CSS_CLASS_PREFIX .
239  'ns-' .
240  ( $nsInfo->isTalk( $rc->mAttribs['rc_namespace'] ) ? 'talk' : 'subject' )
241  );
242 
243  if ( $this->filterGroups !== null ) {
244  foreach ( $this->filterGroups as $filterGroup ) {
245  foreach ( $filterGroup->getFilters() as $filter ) {
246  $filter->applyCssClassIfNeeded( $this, $rc, $classes );
247  }
248  }
249  }
250 
251  return $classes;
252  }
253 
262  public static function flag( $flag, IContextSource $context = null ) {
263  static $map = [ 'minoredit' => 'minor', 'botedit' => 'bot' ];
264  static $flagInfos = null;
265 
266  if ( $flagInfos === null ) {
267  global $wgRecentChangesFlags;
268  $flagInfos = [];
269  foreach ( $wgRecentChangesFlags as $key => $value ) {
270  $flagInfos[$key]['letter'] = $value['letter'];
271  $flagInfos[$key]['title'] = $value['title'];
272  // Allow customized class name, fall back to flag name
273  $flagInfos[$key]['class'] = $value['class'] ?? $key;
274  }
275  }
276 
278 
279  // Inconsistent naming, kepted for b/c
280  if ( isset( $map[$flag] ) ) {
281  $flag = $map[$flag];
282  }
283 
284  $info = $flagInfos[$flag];
285  return Html::element( 'abbr', [
286  'class' => $info['class'],
287  'title' => wfMessage( $info['title'] )->setContext( $context )->text(),
288  ], wfMessage( $info['letter'] )->setContext( $context )->text() );
289  }
290 
295  public function beginRecentChangesList() {
296  $this->rc_cache = [];
297  $this->rcMoveIndex = 0;
298  $this->rcCacheIndex = 0;
299  $this->lastdate = '';
300  $this->rclistOpen = false;
301  $this->getOutput()->addModuleStyles( [
302  'mediawiki.interface.helpers.styles',
303  'mediawiki.special.changeslist'
304  ] );
305 
306  return '<div class="mw-changeslist">';
307  }
308 
312  public function initChangesListRows( $rows ) {
313  Hooks::run( 'ChangesListInitRows', [ $this, $rows ] );
314  }
315 
326  public static function showCharacterDifference( $old, $new, IContextSource $context = null ) {
327  if ( !$context ) {
329  }
330 
331  $new = (int)$new;
332  $old = (int)$old;
333  $szdiff = $new - $old;
334 
336  $config = $context->getConfig();
337  $code = $lang->getCode();
338  static $fastCharDiff = [];
339  if ( !isset( $fastCharDiff[$code] ) ) {
340  $fastCharDiff[$code] = $config->get( 'MiserMode' )
341  || $context->msg( 'rc-change-size' )->plain() === '$1';
342  }
343 
344  $formattedSize = $lang->formatNum( $szdiff );
345 
346  if ( !$fastCharDiff[$code] ) {
347  $formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text();
348  }
349 
350  if ( abs( $szdiff ) > abs( $config->get( 'RCChangedSizeThreshold' ) ) ) {
351  $tag = 'strong';
352  } else {
353  $tag = 'span';
354  }
355 
356  if ( $szdiff === 0 ) {
357  $formattedSizeClass = 'mw-plusminus-null';
358  } elseif ( $szdiff > 0 ) {
359  $formattedSize = '+' . $formattedSize;
360  $formattedSizeClass = 'mw-plusminus-pos';
361  } else {
362  $formattedSizeClass = 'mw-plusminus-neg';
363  }
364  $formattedSizeClass .= ' mw-diff-bytes';
365 
366  $formattedTotalSize = $context->msg( 'rc-change-size-new' )->numParams( $new )->text();
367 
368  return Html::element( $tag,
369  [ 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ],
370  $formattedSize ) . $lang->getDirMark();
371  }
372 
380  public function formatCharacterDifference( RecentChange $old, RecentChange $new = null ) {
381  $oldlen = $old->mAttribs['rc_old_len'];
382 
383  if ( $new ) {
384  $newlen = $new->mAttribs['rc_new_len'];
385  } else {
386  $newlen = $old->mAttribs['rc_new_len'];
387  }
388 
389  if ( $oldlen === null || $newlen === null ) {
390  return '';
391  }
392 
393  return self::showCharacterDifference( $oldlen, $newlen, $this->getContext() );
394  }
395 
400  public function endRecentChangesList() {
401  $out = $this->rclistOpen ? "</ul>\n" : '';
402  $out .= '</div>';
403 
404  return $out;
405  }
406 
418  public static function revDateLink( Revision $rev, User $user, Language $lang, $title = null ) {
419  $ts = $rev->getTimestamp();
420  $date = $lang->userTimeAndDate( $ts, $user );
421  if ( RevisionRecord::userCanBitfield(
422  $rev->getVisibility(),
423  RevisionRecord::DELETED_TEXT,
424  $user
425  ) ) {
426  $link = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
427  $title ?? $rev->getTitle(),
428  $date,
429  [ 'class' => 'mw-changeslist-date' ],
430  [ 'oldid' => $rev->getId() ]
431  );
432  } else {
433  $link = htmlspecialchars( $date );
434  }
435  if ( $rev->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
436  $link = "<span class=\"history-deleted mw-changeslist-date\">$link</span>";
437  }
438  return $link;
439  }
440 
445  public function insertDateHeader( &$s, $rc_timestamp ) {
446  # Make date header if necessary
447  $date = $this->getLanguage()->userDate( $rc_timestamp, $this->getUser() );
448  if ( $date != $this->lastdate ) {
449  if ( $this->lastdate != '' ) {
450  $s .= "</ul>\n";
451  }
452  $s .= Xml::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
453  $this->lastdate = $date;
454  $this->rclistOpen = true;
455  }
456  }
457 
464  public function insertLog( &$s, $title, $logtype, $useParentheses = true ) {
465  $page = new LogPage( $logtype );
466  $logname = $page->getName()->setContext( $this->getContext() )->text();
467  $link = $this->linkRenderer->makeKnownLink( $title, $logname, [
468  'class' => $useParentheses ? '' : 'mw-changeslist-links'
469  ] );
470  if ( $useParentheses ) {
471  $s .= $this->msg( 'parentheses' )->rawParams(
472  $link
473  )->escaped();
474  } else {
475  $s .= $link;
476  }
477  }
478 
484  public function insertDiffHist( &$s, &$rc, $unpatrolled = null ) {
485  # Diff link
486  if (
487  $rc->mAttribs['rc_type'] == RC_NEW ||
488  $rc->mAttribs['rc_type'] == RC_LOG ||
489  $rc->mAttribs['rc_type'] == RC_CATEGORIZE
490  ) {
491  $diffLink = $this->message['diff'];
492  } elseif ( !self::userCan( $rc, RevisionRecord::DELETED_TEXT, $this->getUser() ) ) {
493  $diffLink = $this->message['diff'];
494  } else {
495  $query = [
496  'curid' => $rc->mAttribs['rc_cur_id'],
497  'diff' => $rc->mAttribs['rc_this_oldid'],
498  'oldid' => $rc->mAttribs['rc_last_oldid']
499  ];
500 
501  $diffLink = $this->linkRenderer->makeKnownLink(
502  $rc->getTitle(),
503  new HtmlArmor( $this->message['diff'] ),
504  [ 'class' => 'mw-changeslist-diff' ],
505  $query
506  );
507  }
508  if ( $rc->mAttribs['rc_type'] == RC_CATEGORIZE ) {
509  $histLink = $this->message['hist'];
510  } else {
511  $histLink = $this->linkRenderer->makeKnownLink(
512  $rc->getTitle(),
513  new HtmlArmor( $this->message['hist'] ),
514  [ 'class' => 'mw-changeslist-history' ],
515  [
516  'curid' => $rc->mAttribs['rc_cur_id'],
517  'action' => 'history'
518  ]
519  );
520  }
521 
522  $s .= Html::rawElement( 'div', [ 'class' => 'mw-changeslist-links' ],
523  Html::rawElement( 'span', [], $diffLink ) .
524  Html::rawElement( 'span', [], $histLink )
525  ) .
526  ' <span class="mw-changeslist-separator"></span> ';
527  }
528 
536  public function getArticleLink( &$rc, $unpatrolled, $watched ) {
537  $params = [];
538  if ( $rc->getTitle()->isRedirect() ) {
539  $params = [ 'redirect' => 'no' ];
540  }
541 
542  $articlelink = $this->linkRenderer->makeLink(
543  $rc->getTitle(),
544  null,
545  [ 'class' => 'mw-changeslist-title' ],
546  $params
547  );
548  if ( $this->isDeleted( $rc, RevisionRecord::DELETED_TEXT ) ) {
549  $articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
550  }
551  # To allow for boldening pages watched by this user
552  $articlelink = "<span class=\"mw-title\">{$articlelink}</span>";
553  # RTL/LTR marker
554  $articlelink .= $this->getLanguage()->getDirMark();
555 
556  # TODO: Deprecate the $s argument, it seems happily unused.
557  $s = '';
558  # Avoid PHP 7.1 warning from passing $this by reference
559  $changesList = $this;
560  Hooks::run( 'ChangesListInsertArticleLink',
561  [ &$changesList, &$articlelink, &$s, &$rc, $unpatrolled, $watched ] );
562 
563  return "{$s} {$articlelink}";
564  }
565 
574  public function getTimestamp( $rc ) {
575  // A space is important after mw-changeslist-separator--semicolon to make sure
576  // that whatever comes before it is distinguishable.
577  // (Otherwise your have the text of titles pushing up against the timestamp)
578  // A specific element is used for this purpose as `mw-changeslist-date` is used in a variety
579  // of other places with a different position and the information proceeding getTimestamp can vary.
580  return '<span class="mw-changeslist-separator--semicolon"></span> ' .
581  '<span class="mw-changeslist-date">' .
582  htmlspecialchars( $this->getLanguage()->userTime(
583  $rc->mAttribs['rc_timestamp'],
584  $this->getUser()
585  ) ) . '</span> <span class="mw-changeslist-separator"></span> ';
586  }
587 
594  public function insertTimestamp( &$s, $rc ) {
595  $s .= $this->getTimestamp( $rc );
596  }
597 
604  public function insertUserRelatedLinks( &$s, &$rc ) {
605  if ( $this->isDeleted( $rc, RevisionRecord::DELETED_USER ) ) {
606  $s .= ' <span class="history-deleted">' .
607  $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
608  } else {
609  $s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
610  $rc->mAttribs['rc_user_text'] );
612  $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'],
613  false, 0, null,
614  // The text content of tools is not wrapped with parenthesises or "piped".
615  // This will be handled in CSS (T205581).
616  false
617  );
618  }
619  }
620 
627  public function insertLogEntry( $rc ) {
628  $formatter = LogFormatter::newFromRow( $rc->mAttribs );
629  $formatter->setContext( $this->getContext() );
630  $formatter->setShowUserToolLinks( true );
631  $mark = $this->getLanguage()->getDirMark();
632 
633  return Html::openElement( 'span', [ 'class' => 'mw-changeslist-log-entry' ] )
634  . $formatter->getActionText() . " $mark" . $formatter->getComment()
635  . Html::closeElement( 'span' );
636  }
637 
643  public function insertComment( $rc ) {
644  if ( $this->isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
645  return ' <span class="history-deleted comment">' .
646  $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
647  } else {
648  return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle(),
649  // Whether section links should refer to local page (using default false)
650  false,
651  // wikid to generate links for (using default null) */
652  null,
653  // whether parentheses should be rendered as part of the message
654  false );
655  }
656  }
657 
663  protected function numberofWatchingusers( $count ) {
664  if ( $count <= 0 ) {
665  return '';
666  }
667 
668  return $this->watchMsgCache->getWithSetCallback(
669  "watching-users-msg:$count",
670  function () use ( $count ) {
671  return $this->msg( 'number-of-watching-users-for-recent-changes' )
672  ->numParams( $count )->escaped();
673  }
674  );
675  }
676 
683  public static function isDeleted( $rc, $field ) {
684  return ( $rc->mAttribs['rc_deleted'] & $field ) == $field;
685  }
686 
696  public static function userCan( $rc, $field, User $user = null ) {
697  if ( $user === null ) {
698  $user = RequestContext::getMain()->getUser();
699  }
700 
701  if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
702  return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
703  }
704 
705  return RevisionRecord::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
706  }
707 
713  protected function maybeWatchedLink( $link, $watched = false ) {
714  if ( $watched ) {
715  return '<strong class="mw-watched">' . $link . '</strong>';
716  } else {
717  return '<span class="mw-rc-unwatched">' . $link . '</span>';
718  }
719  }
720 
727  public function insertRollback( &$s, &$rc ) {
728  if ( $rc->mAttribs['rc_type'] == RC_EDIT
729  && $rc->mAttribs['rc_this_oldid']
730  && $rc->mAttribs['rc_cur_id']
731  && $rc->getAttribute( 'page_latest' ) == $rc->mAttribs['rc_this_oldid']
732  ) {
733  $title = $rc->getTitle();
737  if ( MediaWikiServices::getInstance()->getPermissionManager()
738  ->quickUserCan( 'rollback', $this->getUser(), $title )
739  ) {
740  $rev = new Revision( [
741  'title' => $title,
742  'id' => $rc->mAttribs['rc_this_oldid'],
743  'user' => $rc->mAttribs['rc_user'],
744  'user_text' => $rc->mAttribs['rc_user_text'],
745  'actor' => $rc->mAttribs['rc_actor'] ?? null,
746  'deleted' => $rc->mAttribs['rc_deleted']
747  ] );
748  $s .= ' ' . Linker::generateRollback( $rev, $this->getContext(),
749  [ 'noBrackets' ] );
750  }
751  }
752  }
753 
759  public function getRollback( RecentChange $rc ) {
760  $s = '';
761  $this->insertRollback( $s, $rc );
762  return $s;
763  }
764 
770  public function insertTags( &$s, &$rc, &$classes ) {
771  if ( empty( $rc->mAttribs['ts_tags'] ) ) {
772  return;
773  }
774 
775  list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
776  $rc->mAttribs['ts_tags'],
777  'changeslist',
778  $this->getContext()
779  );
780  $classes = array_merge( $classes, $newClasses );
781  $s .= ' ' . $tagSummary;
782  }
783 
790  public function getTags( RecentChange $rc, array &$classes ) {
791  $s = '';
792  $this->insertTags( $s, $rc, $classes );
793  return $s;
794  }
795 
796  public function insertExtra( &$s, &$rc, &$classes ) {
797  // Empty, used for subclasses to add anything special.
798  }
799 
800  protected function showAsUnpatrolled( RecentChange $rc ) {
801  return self::isUnpatrolled( $rc, $this->getUser() );
802  }
803 
809  public static function isUnpatrolled( $rc, User $user ) {
810  if ( $rc instanceof RecentChange ) {
811  $isPatrolled = $rc->mAttribs['rc_patrolled'];
812  $rcType = $rc->mAttribs['rc_type'];
813  $rcLogType = $rc->mAttribs['rc_log_type'];
814  } else {
815  $isPatrolled = $rc->rc_patrolled;
816  $rcType = $rc->rc_type;
817  $rcLogType = $rc->rc_log_type;
818  }
819 
820  if ( !$isPatrolled ) {
821  if ( $user->useRCPatrol() ) {
822  return true;
823  }
824  if ( $user->useNPPatrol() && $rcType == RC_NEW ) {
825  return true;
826  }
827  if ( $user->useFilePatrol() && $rcLogType == 'upload' ) {
828  return true;
829  }
830  }
831 
832  return false;
833  }
834 
844  protected function isCategorizationWithoutRevision( $rcObj ) {
845  return intval( $rcObj->getAttribute( 'rc_type' ) ) === RC_CATEGORIZE
846  && intval( $rcObj->getAttribute( 'rc_this_oldid' ) ) === 0;
847  }
848 
854  protected function getDataAttributes( RecentChange $rc ) {
855  $attrs = [];
856 
857  $type = $rc->getAttribute( 'rc_source' );
858  switch ( $type ) {
861  $attrs['data-mw-revid'] = $rc->mAttribs['rc_this_oldid'];
862  break;
864  $attrs['data-mw-logid'] = $rc->mAttribs['rc_logid'];
865  $attrs['data-mw-logaction'] =
866  $rc->mAttribs['rc_log_type'] . '/' . $rc->mAttribs['rc_log_action'];
867  break;
868  }
869 
870  $attrs[ 'data-mw-ts' ] = $rc->getAttribute( 'rc_timestamp' );
871 
872  return $attrs;
873  }
874 
882  public function setChangeLinePrefixer( callable $prefixer ) {
883  $this->changeLinePrefixer = $prefixer;
884  }
885 }
ChangesList\endRecentChangesList
endRecentChangesList()
Returns text for the end of RC.
Definition: ChangesList.php:400
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:33
ContextSource\getConfig
getConfig()
Definition: ContextSource.php:63
Revision\getTimestamp
getTimestamp()
Definition: Revision.php:832
ContextSource\getContext
getContext()
Get the base IContextSource object.
Definition: ContextSource.php:40
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:28
ChangesList\insertComment
insertComment( $rc)
Insert a formatted comment.
Definition: ChangesList.php:643
Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:46
ChangesList\setWatchlistDivs
setWatchlistDivs( $value=true)
Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag.
Definition: ChangesList.php:146
User\useFilePatrol
useFilePatrol()
Check whether to enable new files patrol features for this user.
Definition: User.php:3606
ChangesList\setChangeLinePrefixer
setChangeLinePrefixer(callable $prefixer)
Sets the callable that generates a change line prefix added to the beginning of each line.
Definition: ChangesList.php:882
IContextSource\getSkin
getSkin()
Linker\userLink
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
Definition: Linker.php:899
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:137
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:37
RecentChange
Utility class for creating new RC entries.
Definition: RecentChange.php:71
ChangesList\$watchMsgCache
MapCacheLRU $watchMsgCache
Definition: ChangesList.php:49
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:41
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:944
ChangesList\maybeWatchedLink
maybeWatchedLink( $link, $watched=false)
Definition: ChangesList.php:713
RC_LOG
const RC_LOG
Definition: Defines.php:133
ChangesList\getTags
getTags(RecentChange $rc, array &$classes)
Definition: ChangesList.php:790
RC_EDIT
const RC_EDIT
Definition: Defines.php:131
ChangesList\getHighlightsContainerDiv
getHighlightsContainerDiv()
Get the container for highlights that are used in the new StructuredFilters system.
Definition: ChangesList.php:123
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1201
$s
$s
Definition: mergeMessageFileList.php:185
ChangesList\$rcCacheIndex
$rcCacheIndex
Definition: ChangesList.php:41
User\useNPPatrol
useNPPatrol()
Check whether to enable new pages patrol features for this user.
Definition: User.php:3594
ChangesList\formatCharacterDifference
formatCharacterDifference(RecentChange $old, RecentChange $new=null)
Format the character difference of one or several changes.
Definition: ChangesList.php:380
User\useRCPatrol
useRCPatrol()
Check whether to enable recent changes patrol features for this user.
Definition: User.php:3585
Revision\getId
getId()
Get revision ID.
Definition: Revision.php:441
ContextSource\getUser
getUser()
Definition: ContextSource.php:120
ChangesList\$lastdate
$lastdate
Definition: ChangesList.php:38
RecentChange\SRC_LOG
const SRC_LOG
Definition: RecentChange.php:76
ChangesList\isDeleted
static isDeleted( $rc, $field)
Determine if said field of a revision is hidden.
Definition: ChangesList.php:683
ContextSource\getLanguage
getLanguage()
Definition: ContextSource.php:128
ChangesList\insertLog
insertLog(&$s, $title, $logtype, $useParentheses=true)
Definition: ChangesList.php:464
Revision
Definition: Revision.php:40
ChangesList\insertDateHeader
insertDateHeader(&$s, $rc_timestamp)
Definition: ChangesList.php:445
ChangesList\$filterGroups
array $filterGroups
Definition: ChangesList.php:59
$wgRecentChangesFlags
$wgRecentChangesFlags
Flags (letter symbols) shown in recent changes and watchlist to indicate certain types of edits.
Definition: DefaultSettings.php:7369
MessageLocalizer\msg
msg( $key,... $params)
This is the method for getting translated interface messages.
Linker\generateRollback
static generateRollback( $rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
Definition: Linker.php:1834
LogFormatter\newFromRow
static newFromRow( $row)
Handy shortcut for constructing a formatter directly from database row.
Definition: LogFormatter.php:70
Wikimedia\Rdbms\IResultWrapper
Result wrapper for grabbing data queried from an IDatabase object.
Definition: IResultWrapper.php:24
ChangesList\insertLogEntry
insertLogEntry( $rc)
Insert a formatted action.
Definition: ChangesList.php:627
getPermissionManager
getPermissionManager()
ContextSource\getOutput
getOutput()
Definition: ContextSource.php:112
ContextSource
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
Definition: ContextSource.php:29
ChangesList\isWatchlist
isWatchlist()
Definition: ChangesList.php:154
ChangesList\insertTags
insertTags(&$s, &$rc, &$classes)
Definition: ChangesList.php:770
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:33
Xml\element
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:41
MapCacheLRU
Handles a simple LRU key/value map with a maximum number of entries.
Definition: MapCacheLRU.php:38
ChangesList\flag
static flag( $flag, IContextSource $context=null)
Make an "<abbr>" element for a given change flag.
Definition: ChangesList.php:262
ChangesList\CSS_CLASS_PREFIX
const CSS_CLASS_PREFIX
Definition: ChangesList.php:30
$title
$title
Definition: testCompression.php:38
RecentChange\SRC_EDIT
const SRC_EDIT
Definition: RecentChange.php:74
RecentChange\SRC_NEW
const SRC_NEW
Definition: RecentChange.php:75
ChangesList\insertUserRelatedLinks
insertUserRelatedLinks(&$s, &$rc)
Insert links to user page, user talk page and eventually a blocking link.
Definition: ChangesList.php:604
ContextSource\setContext
setContext(IContextSource $context)
Definition: ContextSource.php:55
ChangesList\getRollback
getRollback(RecentChange $rc)
Definition: ChangesList.php:759
ChangesList\getArticleLink
getArticleLink(&$rc, $unpatrolled, $watched)
Definition: ChangesList.php:536
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:87
ChangesList\$rclistOpen
$rclistOpen
Definition: ChangesList.php:42
Revision\getTitle
getTitle()
Returns the title of the page associated with this entry.
Definition: Revision.php:565
ChangesList\$changeLinePrefixer
callable $changeLinePrefixer
Definition: ChangesList.php:46
ChangesList\getDataAttributes
getDataAttributes(RecentChange $rc)
Get recommended data attributes for a change line.
Definition: ChangesList.php:854
ContextSource\msg
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:168
EnhancedChangesList
Definition: EnhancedChangesList.php:26
OldChangesList
Definition: OldChangesList.php:25
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:1561
Revision\getVisibility
getVisibility()
Get the deletion bitfield of the revision.
Definition: Revision.php:723
ChangesList\insertTimestamp
insertTimestamp(&$s, $rc)
Insert time timestamp string from $rc into $s.
Definition: ChangesList.php:594
ChangesList\revDateLink
static revDateLink(Revision $rev, User $user, Language $lang, $title=null)
Render the date and time of a revision in the current user language based on whether the user is able...
Definition: ChangesList.php:418
Revision\isDeleted
isDeleted( $field)
Definition: Revision.php:714
ChangesList\numberofWatchingusers
numberofWatchingusers( $count)
Returns the string which indicates the number of watching users.
Definition: ChangesList.php:663
ChangesList\showAsUnpatrolled
showAsUnpatrolled(RecentChange $rc)
Definition: ChangesList.php:800
ChangesList\showCharacterDifference
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
Definition: ChangesList.php:326
IContextSource\getUser
getUser()
RC_NEW
const RC_NEW
Definition: Defines.php:132
ChangesList\preCacheMessages
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often,...
Definition: ChangesList.php:162
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:451
ChangesList\$watchlist
$watchlist
Definition: ChangesList.php:37
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:53
ChangesList\getHTMLClasses
getHTMLClasses( $rc, $watched)
Get an array of default HTML class attributes for the change.
Definition: ChangesList.php:199
ChangesList\__construct
__construct( $obj, array $filterGroups=[])
Definition: ChangesList.php:65
RecentChange\getAttribute
getAttribute( $name)
Get an attribute value.
Definition: RecentChange.php:1037
ChangesList\recentChangesFlags
recentChangesFlags( $flags, $nothing="\u{00A0}")
Returns the appropriate flags for new page, minor change and patrolling.
Definition: ChangesList.php:180
ChangesList\beginRecentChangesList
beginRecentChangesList()
Returns text for the start of the tabular part of RC.
Definition: ChangesList.php:295
ChangesList\insertDiffHist
insertDiffHist(&$s, &$rc, $unpatrolled=null)
Definition: ChangesList.php:484
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:555
ChangesList\initChangesListRows
initChangesListRows( $rows)
Definition: ChangesList.php:312
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:844
ChangesList\getTimestamp
getTimestamp( $rc)
Get the timestamp from $rc formatted with current user's settings and a separator.
Definition: ChangesList.php:574
IContextSource\getRequest
getRequest()
ChangesList
Definition: ChangesList.php:29
ChangesList\$skin
Skin $skin
Definition: ChangesList.php:35
RC_CATEGORIZE
const RC_CATEGORIZE
Definition: Defines.php:135
ChangesList\isUnpatrolled
static isUnpatrolled( $rc, User $user)
Definition: ChangesList.php:809
ChangesList\$rc_cache
$rc_cache
Definition: ChangesList.php:40
ChangesList\$rcMoveIndex
$rcMoveIndex
Definition: ChangesList.php:43
Skin
The main skin class which provides methods and properties for all other skins.
Definition: Skin.php:38
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:53
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
ChangesList\$message
$message
Definition: ChangesList.php:39
ChangeTags\formatSummaryRow
static formatSummaryRow( $tags, $page, IContextSource $context=null)
Creates HTML for the given tags.
Definition: ChangeTags.php:99
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:39
ChangesList\getHTMLClassesForFilters
getHTMLClassesForFilters( $rc)
Get an array of CSS classes attributed to filters for this row.
Definition: ChangesList.php:230
ChangesList\recentChangesLine
recentChangesLine(&$rc, $watched=false, $linenumber=null)
Format a line.
Definition: ChangesList.php:113
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:696
ChangesList\insertExtra
insertExtra(&$s, &$rc, &$classes)
Definition: ChangesList.php:796
ChangesList\insertRollback
insertRollback(&$s, &$rc)
Insert a rollback link.
Definition: ChangesList.php:727
IContextSource\getLanguage
getLanguage()
ChangesList\$linkRenderer
LinkRenderer $linkRenderer
Definition: ChangesList.php:54
$type
$type
Definition: testCompression.php:52