MediaWiki  master
ChangesList.php
Go to the documentation of this file.
1 <?php
25 use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
31 use OOUI\IconWidget;
33 
34 class ChangesList extends ContextSource {
35  use ProtectedHookAccessorTrait;
36 
37  public const CSS_CLASS_PREFIX = 'mw-changeslist-';
38 
42  public $skin;
43 
44  protected $watchlist = false;
45  protected $lastdate;
46  protected $message;
47  protected $rc_cache;
48  protected $rcCacheIndex;
49  protected $rclistOpen;
50  protected $rcMoveIndex;
51 
54 
56  protected $watchMsgCache;
57 
61  protected $linkRenderer;
62 
66  protected $filterGroups;
67 
72  public function __construct( $obj, array $filterGroups = [] ) {
73  if ( $obj instanceof IContextSource ) {
74  $this->setContext( $obj );
75  $this->skin = $obj->getSkin();
76  } else {
77  $this->setContext( $obj->getContext() );
78  $this->skin = $obj;
79  }
80  $this->preCacheMessages();
81  $this->watchMsgCache = new MapCacheLRU( 50 );
82  $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
83  $this->filterGroups = $filterGroups;
84  }
85 
94  public static function newFromContext( IContextSource $context, array $groups = [] ) {
95  $user = $context->getUser();
96  $sk = $context->getSkin();
97  $list = null;
98  if ( Hooks::runner()->onFetchChangesList( $user, $sk, $list, $groups ) ) {
99  $new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
100 
101  return $new ?
102  new EnhancedChangesList( $context, $groups ) :
103  new OldChangesList( $context, $groups );
104  } else {
105  return $list;
106  }
107  }
108 
120  public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
121  throw new RuntimeException( 'recentChangesLine should be implemented' );
122  }
123 
130  protected function getHighlightsContainerDiv() {
131  $highlightColorDivs = '';
132  foreach ( [ 'none', 'c1', 'c2', 'c3', 'c4', 'c5' ] as $color ) {
133  $highlightColorDivs .= Html::rawElement(
134  'div',
135  [
136  'class' => 'mw-rcfilters-ui-highlights-color-' . $color,
137  'data-color' => $color
138  ]
139  );
140  }
141 
142  return Html::rawElement(
143  'div',
144  [ 'class' => 'mw-rcfilters-ui-highlights' ],
145  $highlightColorDivs
146  );
147  }
148 
153  public function setWatchlistDivs( $value = true ) {
154  $this->watchlist = $value;
155  }
156 
161  public function isWatchlist() {
162  return (bool)$this->watchlist;
163  }
164 
169  private function preCacheMessages() {
170  if ( !isset( $this->message ) ) {
171  $this->message = [];
172  foreach ( [
173  'cur', 'diff', 'hist', 'enhancedrc-history', 'last', 'blocklink', 'history',
174  'semicolon-separator', 'pipe-separator' ] as $msg
175  ) {
176  $this->message[$msg] = $this->msg( $msg )->escaped();
177  }
178  }
179  }
180 
187  public function recentChangesFlags( $flags, $nothing = "\u{00A0}" ) {
188  $f = '';
189  foreach ( array_keys( $this->getConfig()->get( 'RecentChangesFlags' ) ) as $flag ) {
190  $f .= isset( $flags[$flag] ) && $flags[$flag]
191  ? self::flag( $flag, $this->getContext() )
192  : $nothing;
193  }
194 
195  return $f;
196  }
197 
206  protected function getHTMLClasses( $rc, $watched ) {
207  $classes = [ self::CSS_CLASS_PREFIX . 'line' ];
208  $logType = $rc->mAttribs['rc_log_type'];
209 
210  if ( $logType ) {
211  $classes[] = self::CSS_CLASS_PREFIX . 'log';
212  $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'log-' . $logType );
213  } else {
214  $classes[] = self::CSS_CLASS_PREFIX . 'edit';
215  $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns' .
216  $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
217  }
218 
219  // Indicate watched status on the line to allow for more
220  // comprehensive styling.
221  $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched
222  ? self::CSS_CLASS_PREFIX . 'line-watched'
223  : self::CSS_CLASS_PREFIX . 'line-not-watched';
224 
225  $classes = array_merge( $classes, $this->getHTMLClassesForFilters( $rc ) );
226 
227  return $classes;
228  }
229 
237  protected function getHTMLClassesForFilters( $rc ) {
238  $classes = [];
239 
240  $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns-' .
241  $rc->mAttribs['rc_namespace'] );
242 
243  $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
244  $classes[] = Sanitizer::escapeClass(
245  self::CSS_CLASS_PREFIX .
246  'ns-' .
247  ( $nsInfo->isTalk( $rc->mAttribs['rc_namespace'] ) ? 'talk' : 'subject' )
248  );
249 
250  if ( $this->filterGroups !== null ) {
251  foreach ( $this->filterGroups as $filterGroup ) {
252  foreach ( $filterGroup->getFilters() as $filter ) {
253  $filter->applyCssClassIfNeeded( $this, $rc, $classes );
254  }
255  }
256  }
257 
258  return $classes;
259  }
260 
269  public static function flag( $flag, IContextSource $context = null ) {
270  static $map = [ 'minoredit' => 'minor', 'botedit' => 'bot' ];
271  static $flagInfos = null;
272 
273  if ( $flagInfos === null ) {
274  global $wgRecentChangesFlags;
275  $flagInfos = [];
276  foreach ( $wgRecentChangesFlags as $key => $value ) {
277  $flagInfos[$key]['letter'] = $value['letter'];
278  $flagInfos[$key]['title'] = $value['title'];
279  // Allow customized class name, fall back to flag name
280  $flagInfos[$key]['class'] = $value['class'] ?? $key;
281  }
282  }
283 
285 
286  // Inconsistent naming, kepted for b/c
287  if ( isset( $map[$flag] ) ) {
288  $flag = $map[$flag];
289  }
290 
291  $info = $flagInfos[$flag];
292  return Html::element( 'abbr', [
293  'class' => $info['class'],
294  'title' => wfMessage( $info['title'] )->setContext( $context )->text(),
295  ], wfMessage( $info['letter'] )->setContext( $context )->text() );
296  }
297 
302  public function beginRecentChangesList() {
303  $this->rc_cache = [];
304  $this->rcMoveIndex = 0;
305  $this->rcCacheIndex = 0;
306  $this->lastdate = '';
307  $this->rclistOpen = false;
308  $this->getOutput()->addModuleStyles( [
309  'mediawiki.interface.helpers.styles',
310  'mediawiki.special.changeslist'
311  ] );
312 
313  return '<div class="mw-changeslist">';
314  }
315 
319  public function initChangesListRows( $rows ) {
320  $this->getHookRunner()->onChangesListInitRows( $this, $rows );
321  }
322 
333  public static function showCharacterDifference( $old, $new, IContextSource $context = null ) {
334  if ( !$context ) {
336  }
337 
338  $new = (int)$new;
339  $old = (int)$old;
340  $szdiff = $new - $old;
341 
343  $config = $context->getConfig();
344  $code = $lang->getCode();
345  static $fastCharDiff = [];
346  if ( !isset( $fastCharDiff[$code] ) ) {
347  $fastCharDiff[$code] = $config->get( 'MiserMode' )
348  || $context->msg( 'rc-change-size' )->plain() === '$1';
349  }
350 
351  $formattedSize = $lang->formatNum( $szdiff );
352 
353  if ( !$fastCharDiff[$code] ) {
354  $formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text();
355  }
356 
357  if ( abs( $szdiff ) > abs( $config->get( 'RCChangedSizeThreshold' ) ) ) {
358  $tag = 'strong';
359  } else {
360  $tag = 'span';
361  }
362 
363  if ( $szdiff === 0 ) {
364  $formattedSizeClass = 'mw-plusminus-null';
365  } elseif ( $szdiff > 0 ) {
366  $formattedSize = '+' . $formattedSize;
367  $formattedSizeClass = 'mw-plusminus-pos';
368  } else {
369  $formattedSizeClass = 'mw-plusminus-neg';
370  }
371  $formattedSizeClass .= ' mw-diff-bytes';
372 
373  $formattedTotalSize = $context->msg( 'rc-change-size-new' )->numParams( $new )->text();
374 
375  return Html::element( $tag,
376  [ 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ],
377  $formattedSize ) . $lang->getDirMark();
378  }
379 
387  public function formatCharacterDifference( RecentChange $old, RecentChange $new = null ) {
388  $oldlen = $old->mAttribs['rc_old_len'];
389 
390  if ( $new ) {
391  $newlen = $new->mAttribs['rc_new_len'];
392  } else {
393  $newlen = $old->mAttribs['rc_new_len'];
394  }
395 
396  if ( $oldlen === null || $newlen === null ) {
397  return '';
398  }
399 
400  return self::showCharacterDifference( $oldlen, $newlen, $this->getContext() );
401  }
402 
407  public function endRecentChangesList() {
408  $out = $this->rclistOpen ? "</ul>\n" : '';
409  $out .= '</div>';
410 
411  return $out;
412  }
413 
425  public static function revDateLink(
426  RevisionRecord $rev,
427  User $user,
428  Language $lang,
429  $title = null
430  ) {
431  $ts = $rev->getTimestamp();
432  $date = $lang->userTimeAndDate( $ts, $user );
433  if ( RevisionRecord::userCanBitfield(
434  $rev->getVisibility(),
435  RevisionRecord::DELETED_TEXT,
436  $user
437  ) ) {
438  $link = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
439  $title ?? $rev->getPageAsLinkTarget(),
440  $date,
441  [ 'class' => 'mw-changeslist-date' ],
442  [ 'oldid' => $rev->getId() ]
443  );
444  } else {
445  $link = htmlspecialchars( $date );
446  }
447  if ( $rev->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
448  $link = "<span class=\"history-deleted mw-changeslist-date\">$link</span>";
449  }
450  return $link;
451  }
452 
457  public function insertDateHeader( &$s, $rc_timestamp ) {
458  # Make date header if necessary
459  $date = $this->getLanguage()->userDate( $rc_timestamp, $this->getUser() );
460  if ( $date != $this->lastdate ) {
461  if ( $this->lastdate != '' ) {
462  $s .= "</ul>\n";
463  }
464  $s .= Xml::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
465  $this->lastdate = $date;
466  $this->rclistOpen = true;
467  }
468  }
469 
476  public function insertLog( &$s, $title, $logtype, $useParentheses = true ) {
477  $page = new LogPage( $logtype );
478  $logname = $page->getName()->setContext( $this->getContext() )->text();
479  $link = $this->linkRenderer->makeKnownLink( $title, $logname, [
480  'class' => $useParentheses ? '' : 'mw-changeslist-links'
481  ] );
482  if ( $useParentheses ) {
483  $s .= $this->msg( 'parentheses' )->rawParams(
484  $link
485  )->escaped();
486  } else {
487  $s .= $link;
488  }
489  }
490 
496  public function insertDiffHist( &$s, &$rc, $unpatrolled = null ) {
497  # Diff link
498  if (
499  $rc->mAttribs['rc_type'] == RC_NEW ||
500  $rc->mAttribs['rc_type'] == RC_LOG ||
501  $rc->mAttribs['rc_type'] == RC_CATEGORIZE
502  ) {
503  $diffLink = $this->message['diff'];
504  } elseif ( !self::userCan( $rc, RevisionRecord::DELETED_TEXT, $this->getUser() ) ) {
505  $diffLink = $this->message['diff'];
506  } else {
507  $query = [
508  'curid' => $rc->mAttribs['rc_cur_id'],
509  'diff' => $rc->mAttribs['rc_this_oldid'],
510  'oldid' => $rc->mAttribs['rc_last_oldid']
511  ];
512 
513  $diffLink = $this->linkRenderer->makeKnownLink(
514  $rc->getTitle(),
515  new HtmlArmor( $this->message['diff'] ),
516  [ 'class' => 'mw-changeslist-diff' ],
517  $query
518  );
519  }
520  if ( $rc->mAttribs['rc_type'] == RC_CATEGORIZE ) {
521  $histLink = $this->message['hist'];
522  } else {
523  $histLink = $this->linkRenderer->makeKnownLink(
524  $rc->getTitle(),
525  new HtmlArmor( $this->message['hist'] ),
526  [ 'class' => 'mw-changeslist-history' ],
527  [
528  'curid' => $rc->mAttribs['rc_cur_id'],
529  'action' => 'history'
530  ]
531  );
532  }
533 
534  $s .= Html::rawElement( 'div', [ 'class' => 'mw-changeslist-links' ],
535  Html::rawElement( 'span', [], $diffLink ) .
536  Html::rawElement( 'span', [], $histLink )
537  ) .
538  ' <span class="mw-changeslist-separator"></span> ';
539  }
540 
551  public function getArticleLink( &$rc, $unpatrolled, $watched ) {
552  $params = [];
553  if ( $rc->getTitle()->isRedirect() ) {
554  $params = [ 'redirect' => 'no' ];
555  }
556 
557  $articlelink = $this->linkRenderer->makeLink(
558  $rc->getTitle(),
559  null,
560  [ 'class' => 'mw-changeslist-title' ],
561  $params
562  );
563  if ( $this->isDeleted( $rc, RevisionRecord::DELETED_TEXT ) ) {
564  $articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
565  }
566  # To allow for boldening pages watched by this user
567  $articlelink = "<span class=\"mw-title\">{$articlelink}</span>";
568  # RTL/LTR marker
569  $articlelink .= $this->getLanguage()->getDirMark();
570 
571  # TODO: Deprecate the $s argument, it seems happily unused.
572  $s = '';
573  $this->getHookRunner()->onChangesListInsertArticleLink( $this, $articlelink,
574  $s, $rc, $unpatrolled, $watched );
575 
576  // Watchlist expiry icon.
577  $watchlistExpiry = '';
578  if ( isset( $rc->watchlistExpiry ) && $rc->watchlistExpiry ) {
579  $watchlistExpiry = $this->getWatchlistExpiry( $rc );
580  }
581 
582  return "{$s} {$articlelink}{$watchlistExpiry}";
583  }
584 
591  public function getWatchlistExpiry( RecentChange $recentChange ): string {
592  $item = WatchedItem::newFromRecentChange( $recentChange, $this->getUser() );
593  // Guard against expired items, even though they shouldn't come here.
594  if ( $item->isExpired() ) {
595  return '';
596  }
597  $daysLeft = $item->getExpiryInDays();
598  $daysLeftMsg = $this->msg( 'watchlist-expires-in', $daysLeft );
599  // Matching widget is also created in ChangesListSpecialPage, for the legend.
600  $widget = new IconWidget( [
601  'icon' => 'clock',
602  'title' => $daysLeftMsg->text(),
603  'classes' => [ 'mw-changesList-watchlistExpiry' ],
604  ] );
605  // Add labels for assistive technologies.
606  $widget->setAttributes( [
607  'role' => 'img',
608  'aria-label' => $this->msg( 'watchlist-expires-in-aria-label' )->text(),
609  ] );
610  // Add spaces around the widget (the page title is to one side,
611  // and a semicolon or opening-parenthesis to the other).
612  return " $widget ";
613  }
614 
623  public function getTimestamp( $rc ) {
624  // This uses the semi-colon separator unless there's a watchlist expiry date for the entry,
625  // because in that case the timestamp is preceeded by a clock icon.
626  // A space is important after mw-changeslist-separator--semicolon to make sure
627  // that whatever comes before it is distinguishable.
628  // (Otherwise your have the text of titles pushing up against the timestamp)
629  // A specific element is used for this purpose as `mw-changeslist-date` is used in a variety
630  // of other places with a different position and the information proceeding getTimestamp can vary.
631  $separatorClass = $rc->watchlistExpiry ? 'mw-changeslist-separator' : 'mw-changeslist-separator--semicolon';
632  return Html::element( 'span', [ 'class' => $separatorClass ] ) . ' ' .
633  '<span class="mw-changeslist-date">' .
634  htmlspecialchars( $this->getLanguage()->userTime(
635  $rc->mAttribs['rc_timestamp'],
636  $this->getUser()
637  ) ) . '</span> <span class="mw-changeslist-separator"></span> ';
638  }
639 
646  public function insertTimestamp( &$s, $rc ) {
647  $s .= $this->getTimestamp( $rc );
648  }
649 
656  public function insertUserRelatedLinks( &$s, &$rc ) {
657  if ( $this->isDeleted( $rc, RevisionRecord::DELETED_USER ) ) {
658  $s .= ' <span class="history-deleted">' .
659  $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
660  } else {
661  $s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
662  $rc->mAttribs['rc_user_text'] );
664  $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'],
665  false, 0, null,
666  // The text content of tools is not wrapped with parenthesises or "piped".
667  // This will be handled in CSS (T205581).
668  false
669  );
670  }
671  }
672 
679  public function insertLogEntry( $rc ) {
680  $formatter = LogFormatter::newFromRow( $rc->mAttribs );
681  $formatter->setContext( $this->getContext() );
682  $formatter->setShowUserToolLinks( true );
683  $mark = $this->getLanguage()->getDirMark();
684 
685  return Html::openElement( 'span', [ 'class' => 'mw-changeslist-log-entry' ] )
686  . $formatter->getActionText() . " $mark" . $formatter->getComment()
687  . Html::closeElement( 'span' );
688  }
689 
695  public function insertComment( $rc ) {
696  if ( $this->isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
697  return ' <span class="history-deleted comment">' .
698  $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
699  } else {
700  return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle(),
701  // Whether section links should refer to local page (using default false)
702  false,
703  // wikid to generate links for (using default null) */
704  null,
705  // whether parentheses should be rendered as part of the message
706  false );
707  }
708  }
709 
715  protected function numberofWatchingusers( $count ) {
716  if ( $count <= 0 ) {
717  return '';
718  }
719 
720  return $this->watchMsgCache->getWithSetCallback(
721  "watching-users-msg:$count",
722  function () use ( $count ) {
723  return $this->msg( 'number-of-watching-users-for-recent-changes' )
724  ->numParams( $count )->escaped();
725  }
726  );
727  }
728 
735  public static function isDeleted( $rc, $field ) {
736  return ( $rc->mAttribs['rc_deleted'] & $field ) == $field;
737  }
738 
748  public static function userCan( $rc, $field, User $user = null ) {
749  if ( $user === null ) {
750  $user = RequestContext::getMain()->getUser();
751  }
752 
753  if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
754  return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
755  }
756 
757  return RevisionRecord::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
758  }
759 
765  protected function maybeWatchedLink( $link, $watched = false ) {
766  if ( $watched ) {
767  return '<strong class="mw-watched">' . $link . '</strong>';
768  } else {
769  return '<span class="mw-rc-unwatched">' . $link . '</span>';
770  }
771  }
772 
779  public function insertRollback( &$s, &$rc ) {
780  if ( $rc->mAttribs['rc_type'] == RC_EDIT
781  && $rc->mAttribs['rc_this_oldid']
782  && $rc->mAttribs['rc_cur_id']
783  && $rc->getAttribute( 'page_latest' ) == $rc->mAttribs['rc_this_oldid']
784  ) {
785  $title = $rc->getTitle();
789  if ( MediaWikiServices::getInstance()->getPermissionManager()
790  ->quickUserCan( 'rollback', $this->getUser(), $title )
791  ) {
792  $revRecord = new MutableRevisionRecord( $title );
793  $revRecord->setId( (int)$rc->mAttribs['rc_this_oldid'] );
794  $revRecord->setVisibility( (int)$rc->mAttribs['rc_deleted'] );
795  $user = new UserIdentityValue(
796  (int)$rc->mAttribs['rc_user'],
797  $rc->mAttribs['rc_user_text'],
798  (int)( $rc->mAttribs['rc_actor'] ?? 0 )
799  );
800  $revRecord->setUser( $user );
801 
802  $s .= ' ';
804  $revRecord,
805  $this->getContext(),
806  [ 'noBrackets' ]
807  );
808  }
809  }
810  }
811 
817  public function getRollback( RecentChange $rc ) {
818  $s = '';
819  $this->insertRollback( $s, $rc );
820  return $s;
821  }
822 
828  public function insertTags( &$s, &$rc, &$classes ) {
829  if ( empty( $rc->mAttribs['ts_tags'] ) ) {
830  return;
831  }
832 
833  list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
834  $rc->mAttribs['ts_tags'],
835  'changeslist',
836  $this->getContext()
837  );
838  $classes = array_merge( $classes, $newClasses );
839  $s .= ' ' . $tagSummary;
840  }
841 
848  public function getTags( RecentChange $rc, array &$classes ) {
849  $s = '';
850  $this->insertTags( $s, $rc, $classes );
851  return $s;
852  }
853 
854  public function insertExtra( &$s, &$rc, &$classes ) {
855  // Empty, used for subclasses to add anything special.
856  }
857 
858  protected function showAsUnpatrolled( RecentChange $rc ) {
859  return self::isUnpatrolled( $rc, $this->getUser() );
860  }
861 
867  public static function isUnpatrolled( $rc, User $user ) {
868  if ( $rc instanceof RecentChange ) {
869  $isPatrolled = $rc->mAttribs['rc_patrolled'];
870  $rcType = $rc->mAttribs['rc_type'];
871  $rcLogType = $rc->mAttribs['rc_log_type'];
872  } else {
873  $isPatrolled = $rc->rc_patrolled;
874  $rcType = $rc->rc_type;
875  $rcLogType = $rc->rc_log_type;
876  }
877 
878  if ( !$isPatrolled ) {
879  if ( $user->useRCPatrol() ) {
880  return true;
881  }
882  if ( $user->useNPPatrol() && $rcType == RC_NEW ) {
883  return true;
884  }
885  if ( $user->useFilePatrol() && $rcLogType == 'upload' ) {
886  return true;
887  }
888  }
889 
890  return false;
891  }
892 
902  protected function isCategorizationWithoutRevision( $rcObj ) {
903  return intval( $rcObj->getAttribute( 'rc_type' ) ) === RC_CATEGORIZE
904  && intval( $rcObj->getAttribute( 'rc_this_oldid' ) ) === 0;
905  }
906 
912  protected function getDataAttributes( RecentChange $rc ) {
913  $attrs = [];
914 
915  $type = $rc->getAttribute( 'rc_source' );
916  switch ( $type ) {
919  $attrs['data-mw-revid'] = $rc->mAttribs['rc_this_oldid'];
920  break;
922  $attrs['data-mw-logid'] = $rc->mAttribs['rc_logid'];
923  $attrs['data-mw-logaction'] =
924  $rc->mAttribs['rc_log_type'] . '/' . $rc->mAttribs['rc_log_action'];
925  break;
926  }
927 
928  $attrs[ 'data-mw-ts' ] = $rc->getAttribute( 'rc_timestamp' );
929 
930  return $attrs;
931  }
932 
940  public function setChangeLinePrefixer( callable $prefixer ) {
941  $this->changeLinePrefixer = $prefixer;
942  }
943 }
MediaWiki\User\UserIdentityValue
Value object representing a user's identity.
Definition: UserIdentityValue.php:32
ChangesList\endRecentChangesList
endRecentChangesList()
Returns text for the end of RC.
Definition: ChangesList.php:407
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:33
ContextSource\getConfig
getConfig()
Definition: ContextSource.php:63
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:695
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:153
User\useFilePatrol
useFilePatrol()
Check whether to enable new files patrol features for this user.
Definition: User.php:3199
ChangesList\setChangeLinePrefixer
setChangeLinePrefixer(callable $prefixer)
Sets the callable that generates a change line prefix added to the beginning of each line.
Definition: ChangesList.php:940
IContextSource\getSkin
getSkin()
Linker\userLink
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
Definition: Linker.php:896
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:152
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:37
Revision\RevisionRecord\isDeleted
isDeleted( $field)
MCR migration note: this replaces Revision::isDeleted.
Definition: RevisionRecord.php:420
RecentChange
Utility class for creating new RC entries.
Definition: RecentChange.php:72
ChangesList\$watchMsgCache
MapCacheLRU $watchMsgCache
Definition: ChangesList.php:56
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:43
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:941
ChangesList\maybeWatchedLink
maybeWatchedLink( $link, $watched=false)
Definition: ChangesList.php:765
RC_LOG
const RC_LOG
Definition: Defines.php:133
Revision\RevisionRecord\getTimestamp
getTimestamp()
MCR migration note: this replaces Revision::getTimestamp.
Definition: RevisionRecord.php:442
ChangesList\getTags
getTags(RecentChange $rc, array &$classes)
Definition: ChangesList.php:848
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:130
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1222
$s
$s
Definition: mergeMessageFileList.php:185
ChangesList\$rcCacheIndex
$rcCacheIndex
Definition: ChangesList.php:48
Sanitizer\escapeClass
static escapeClass( $class)
Given a value, escape it so that it can be used as a CSS class and return it.
Definition: Sanitizer.php:1264
User\useNPPatrol
useNPPatrol()
Check whether to enable new pages patrol features for this user.
Definition: User.php:3187
ChangesList\formatCharacterDifference
formatCharacterDifference(RecentChange $old, RecentChange $new=null)
Format the character difference of one or several changes.
Definition: ChangesList.php:387
User\useRCPatrol
useRCPatrol()
Check whether to enable recent changes patrol features for this user.
Definition: User.php:3178
ContextSource\getUser
getUser()
Definition: ContextSource.php:120
ChangesList\$lastdate
$lastdate
Definition: ChangesList.php:45
WatchedItem\newFromRecentChange
static newFromRecentChange(RecentChange $recentChange, UserIdentity $user)
Definition: WatchedItem.php:87
RecentChange\SRC_LOG
const SRC_LOG
Definition: RecentChange.php:77
ChangesList\isDeleted
static isDeleted( $rc, $field)
Determine if said field of a revision is hidden.
Definition: ChangesList.php:735
ContextSource\getLanguage
getLanguage()
Definition: ContextSource.php:128
ChangesList\insertLog
insertLog(&$s, $title, $logtype, $useParentheses=true)
Definition: ChangesList.php:476
ChangesList\insertDateHeader
insertDateHeader(&$s, $rc_timestamp)
Definition: ChangesList.php:457
ChangesList\$filterGroups
array $filterGroups
Definition: ChangesList.php:66
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:315
$wgRecentChangesFlags
$wgRecentChangesFlags
Flags (letter symbols) shown in recent changes and watchlist to indicate certain types of edits.
Definition: DefaultSettings.php:7508
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:1861
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:679
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:161
ChangesList\insertTags
insertTags(&$s, &$rc, &$classes)
Definition: ChangesList.php:828
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:269
ChangesList\CSS_CLASS_PREFIX
const CSS_CLASS_PREFIX
Definition: ChangesList.php:37
$title
$title
Definition: testCompression.php:38
RecentChange\SRC_EDIT
const SRC_EDIT
Definition: RecentChange.php:75
RecentChange\SRC_NEW
const SRC_NEW
Definition: RecentChange.php:76
ChangesList\insertUserRelatedLinks
insertUserRelatedLinks(&$s, &$rc)
Insert links to user page, user talk page and eventually a blocking link.
Definition: ChangesList.php:656
ContextSource\setContext
setContext(IContextSource $context)
Definition: ContextSource.php:55
ChangesList\getRollback
getRollback(RecentChange $rc)
Definition: ChangesList.php:817
ChangesList\getArticleLink
getArticleLink(&$rc, $unpatrolled, $watched)
Get the HTML link to the changed page, possibly with a prefix from hook handlers, and a suffix for te...
Definition: ChangesList.php:551
Revision\RevisionRecord\getId
getId()
Get revision ID.
Definition: RevisionRecord.php:279
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:94
ChangesList\$rclistOpen
$rclistOpen
Definition: ChangesList.php:49
ChangesList\$changeLinePrefixer
callable $changeLinePrefixer
Definition: ChangesList.php:53
ChangesList\getDataAttributes
getDataAttributes(RecentChange $rc)
Get recommended data attributes for a change line.
Definition: ChangesList.php:912
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:1574
Revision\MutableRevisionRecord
Definition: MutableRevisionRecord.php:43
Hooks\runner
static runner()
Get a HookRunner instance for calling hooks using the new interfaces.
Definition: Hooks.php:172
ChangesList\insertTimestamp
insertTimestamp(&$s, $rc)
Insert time timestamp string from $rc into $s.
Definition: ChangesList.php:646
ChangesList\numberofWatchingusers
numberofWatchingusers( $count)
Returns the string which indicates the number of watching users.
Definition: ChangesList.php:715
ChangesList\showAsUnpatrolled
showAsUnpatrolled(RecentChange $rc)
Definition: ChangesList.php:858
ChangesList\showCharacterDifference
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
Definition: ChangesList.php:333
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:169
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:451
ChangesList\$watchlist
$watchlist
Definition: ChangesList.php:44
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:206
ChangesList\__construct
__construct( $obj, array $filterGroups=[])
Definition: ChangesList.php:72
RecentChange\getAttribute
getAttribute( $name)
Get an attribute value.
Definition: RecentChange.php:1044
Revision\RevisionRecord\getVisibility
getVisibility()
Get the deletion bitfield of the revision.
Definition: RevisionRecord.php:431
ChangesList\recentChangesFlags
recentChangesFlags( $flags, $nothing="\u{00A0}")
Returns the appropriate flags for new page, minor change and patrolling.
Definition: ChangesList.php:187
Revision\RevisionRecord\getPageAsLinkTarget
getPageAsLinkTarget()
Returns the title of the page this revision is associated with as a LinkTarget object.
Definition: RevisionRecord.php:351
ChangesList\beginRecentChangesList
beginRecentChangesList()
Returns text for the start of the tabular part of RC.
Definition: ChangesList.php:302
ChangesList\insertDiffHist
insertDiffHist(&$s, &$rc, $unpatrolled=null)
Definition: ChangesList.php:496
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:560
ChangesList\initChangesListRows
initChangesListRows( $rows)
Definition: ChangesList.php:319
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:902
Html\openElement
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:251
Html\rawElement
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:209
ChangesList\getTimestamp
getTimestamp( $rc)
Get the timestamp from $rc formatted with current user's settings and a separator.
Definition: ChangesList.php:623
IContextSource\getRequest
getRequest()
ChangesList
Definition: ChangesList.php:34
ChangesList\$skin
Skin $skin
Definition: ChangesList.php:42
RC_CATEGORIZE
const RC_CATEGORIZE
Definition: Defines.php:135
ChangesList\isUnpatrolled
static isUnpatrolled( $rc, User $user)
Definition: ChangesList.php:867
ChangesList\$rc_cache
$rc_cache
Definition: ChangesList.php:47
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:231
ChangesList\$rcMoveIndex
$rcMoveIndex
Definition: ChangesList.php:50
ChangesList\revDateLink
static revDateLink(RevisionRecord $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:425
Skin
The main skin class which provides methods and properties for all other skins.
Definition: Skin.php:40
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:54
ChangesList\$message
$message
Definition: ChangesList.php:46
ChangeTags\formatSummaryRow
static formatSummaryRow( $tags, $page, IContextSource $context=null)
Creates HTML for the given tags.
Definition: ChangeTags.php:100
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:41
ChangesList\getHTMLClassesForFilters
getHTMLClassesForFilters( $rc)
Get an array of CSS classes attributed to filters for this row.
Definition: ChangesList.php:237
ChangesList\recentChangesLine
recentChangesLine(&$rc, $watched=false, $linenumber=null)
Format a line.
Definition: ChangesList.php:120
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:748
ChangesList\insertExtra
insertExtra(&$s, &$rc, &$classes)
Definition: ChangesList.php:854
ChangesList\insertRollback
insertRollback(&$s, &$rc)
Insert a rollback link.
Definition: ChangesList.php:779
IContextSource\getLanguage
getLanguage()
ChangesList\getWatchlistExpiry
getWatchlistExpiry(RecentChange $recentChange)
Get HTML to display the clock icon for watched items that have a watchlist expiry time.
Definition: ChangesList.php:591
ChangesList\$linkRenderer
LinkRenderer $linkRenderer
Definition: ChangesList.php:61
$type
$type
Definition: testCompression.php:52