MediaWiki  1.33.0
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 
46 
48  protected $watchMsgCache;
49 
53  protected $linkRenderer;
54 
58  protected $filterGroups;
59 
64  public function __construct( $obj, array $filterGroups = [] ) {
65  if ( $obj instanceof IContextSource ) {
66  $this->setContext( $obj );
67  $this->skin = $obj->getSkin();
68  } else {
69  $this->setContext( $obj->getContext() );
70  $this->skin = $obj;
71  }
72  $this->preCacheMessages();
73  $this->watchMsgCache = new MapCacheLRU( 50 );
74  $this->linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
75  $this->filterGroups = $filterGroups;
76  }
77 
86  public static function newFromContext( IContextSource $context, array $groups = [] ) {
87  $user = $context->getUser();
88  $sk = $context->getSkin();
89  $list = null;
90  if ( Hooks::run( 'FetchChangesList', [ $user, &$sk, &$list ] ) ) {
91  $new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
92 
93  return $new ?
94  new EnhancedChangesList( $context, $groups ) :
95  new OldChangesList( $context, $groups );
96  } else {
97  return $list;
98  }
99  }
100 
112  public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
113  throw new RuntimeException( 'recentChangesLine should be implemented' );
114  }
115 
122  protected function getHighlightsContainerDiv() {
123  $highlightColorDivs = '';
124  foreach ( [ 'none', 'c1', 'c2', 'c3', 'c4', 'c5' ] as $color ) {
125  $highlightColorDivs .= Html::rawElement(
126  'div',
127  [
128  'class' => 'mw-rcfilters-ui-highlights-color-' . $color,
129  'data-color' => $color
130  ]
131  );
132  }
133 
134  return Html::rawElement(
135  'div',
136  [ 'class' => 'mw-rcfilters-ui-highlights' ],
137  $highlightColorDivs
138  );
139  }
140 
145  public function setWatchlistDivs( $value = true ) {
146  $this->watchlist = $value;
147  }
148 
153  public function isWatchlist() {
154  return (bool)$this->watchlist;
155  }
156 
161  private function preCacheMessages() {
162  if ( !isset( $this->message ) ) {
163  foreach ( [
164  'cur', 'diff', 'hist', 'enhancedrc-history', 'last', 'blocklink', 'history',
165  'semicolon-separator', 'pipe-separator' ] as $msg
166  ) {
167  $this->message[$msg] = $this->msg( $msg )->escaped();
168  }
169  }
170  }
171 
178  public function recentChangesFlags( $flags, $nothing = "\u{00A0}" ) {
179  $f = '';
180  foreach ( array_keys( $this->getConfig()->get( 'RecentChangesFlags' ) ) as $flag ) {
181  $f .= isset( $flags[$flag] ) && $flags[$flag]
182  ? self::flag( $flag, $this->getContext() )
183  : $nothing;
184  }
185 
186  return $f;
187  }
188 
197  protected function getHTMLClasses( $rc, $watched ) {
198  $classes = [ self::CSS_CLASS_PREFIX . 'line' ];
199  $logType = $rc->mAttribs['rc_log_type'];
200 
201  if ( $logType ) {
202  $classes[] = self::CSS_CLASS_PREFIX . 'log';
203  $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'log-' . $logType );
204  } else {
205  $classes[] = self::CSS_CLASS_PREFIX . 'edit';
206  $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns' .
207  $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
208  }
209 
210  // Indicate watched status on the line to allow for more
211  // comprehensive styling.
212  $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched
213  ? self::CSS_CLASS_PREFIX . 'line-watched'
214  : self::CSS_CLASS_PREFIX . 'line-not-watched';
215 
216  $classes = array_merge( $classes, $this->getHTMLClassesForFilters( $rc ) );
217 
218  return $classes;
219  }
220 
228  protected function getHTMLClassesForFilters( $rc ) {
229  $classes = [];
230 
231  $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns-' .
232  $rc->mAttribs['rc_namespace'] );
233 
234  if ( $this->filterGroups !== null ) {
235  foreach ( $this->filterGroups as $filterGroup ) {
236  foreach ( $filterGroup->getFilters() as $filter ) {
237  $filter->applyCssClassIfNeeded( $this, $rc, $classes );
238  }
239  }
240  }
241 
242  return $classes;
243  }
244 
253  public static function flag( $flag, IContextSource $context = null ) {
254  static $map = [ 'minoredit' => 'minor', 'botedit' => 'bot' ];
255  static $flagInfos = null;
256 
257  if ( is_null( $flagInfos ) ) {
258  global $wgRecentChangesFlags;
259  $flagInfos = [];
260  foreach ( $wgRecentChangesFlags as $key => $value ) {
261  $flagInfos[$key]['letter'] = $value['letter'];
262  $flagInfos[$key]['title'] = $value['title'];
263  // Allow customized class name, fall back to flag name
264  $flagInfos[$key]['class'] = $value['class'] ?? $key;
265  }
266  }
267 
269 
270  // Inconsistent naming, kepted for b/c
271  if ( isset( $map[$flag] ) ) {
272  $flag = $map[$flag];
273  }
274 
275  $info = $flagInfos[$flag];
276  return Html::element( 'abbr', [
277  'class' => $info['class'],
278  'title' => wfMessage( $info['title'] )->setContext( $context )->text(),
279  ], wfMessage( $info['letter'] )->setContext( $context )->text() );
280  }
281 
286  public function beginRecentChangesList() {
287  $this->rc_cache = [];
288  $this->rcMoveIndex = 0;
289  $this->rcCacheIndex = 0;
290  $this->lastdate = '';
291  $this->rclistOpen = false;
292  $this->getOutput()->addModuleStyles( [
293  'mediawiki.interface.helpers.styles',
294  'mediawiki.special.changeslist'
295  ] );
296 
297  return '<div class="mw-changeslist">';
298  }
299 
303  public function initChangesListRows( $rows ) {
304  Hooks::run( 'ChangesListInitRows', [ $this, $rows ] );
305  }
306 
317  public static function showCharacterDifference( $old, $new, IContextSource $context = null ) {
318  if ( !$context ) {
320  }
321 
322  $new = (int)$new;
323  $old = (int)$old;
324  $szdiff = $new - $old;
325 
327  $config = $context->getConfig();
328  $code = $lang->getCode();
329  static $fastCharDiff = [];
330  if ( !isset( $fastCharDiff[$code] ) ) {
331  $fastCharDiff[$code] = $config->get( 'MiserMode' )
332  || $context->msg( 'rc-change-size' )->plain() === '$1';
333  }
334 
335  $formattedSize = $lang->formatNum( $szdiff );
336 
337  if ( !$fastCharDiff[$code] ) {
338  $formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text();
339  }
340 
341  if ( abs( $szdiff ) > abs( $config->get( 'RCChangedSizeThreshold' ) ) ) {
342  $tag = 'strong';
343  } else {
344  $tag = 'span';
345  }
346 
347  if ( $szdiff === 0 ) {
348  $formattedSizeClass = 'mw-plusminus-null';
349  } elseif ( $szdiff > 0 ) {
350  $formattedSize = '+' . $formattedSize;
351  $formattedSizeClass = 'mw-plusminus-pos';
352  } else {
353  $formattedSizeClass = 'mw-plusminus-neg';
354  }
355  $formattedSizeClass .= ' mw-diff-bytes';
356 
357  $formattedTotalSize = $context->msg( 'rc-change-size-new' )->numParams( $new )->text();
358 
359  return Html::element( $tag,
360  [ 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ],
361  $formattedSize ) . $lang->getDirMark();
362  }
363 
371  public function formatCharacterDifference( RecentChange $old, RecentChange $new = null ) {
372  $oldlen = $old->mAttribs['rc_old_len'];
373 
374  if ( $new ) {
375  $newlen = $new->mAttribs['rc_new_len'];
376  } else {
377  $newlen = $old->mAttribs['rc_new_len'];
378  }
379 
380  if ( $oldlen === null || $newlen === null ) {
381  return '';
382  }
383 
384  return self::showCharacterDifference( $oldlen, $newlen, $this->getContext() );
385  }
386 
391  public function endRecentChangesList() {
392  $out = $this->rclistOpen ? "</ul>\n" : '';
393  $out .= '</div>';
394 
395  return $out;
396  }
397 
409  public static function revDateLink( Revision $rev, User $user, Language $lang, $title = null ) {
410  $ts = $rev->getTimestamp();
411  $date = $lang->userTimeAndDate( $ts, $user );
412  if ( $rev->userCan( Revision::DELETED_TEXT, $user ) ) {
413  $link = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
414  $title !== null ? $title : $rev->getTitle(),
415  $date,
416  [ 'class' => 'mw-changeslist-date' ],
417  [ 'oldid' => $rev->getId() ]
418  );
419  } else {
420  $link = htmlspecialchars( $date );
421  }
422  if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
423  $link = "<span class=\"history-deleted mw-changeslist-date\">$link</span>";
424  }
425  return $link;
426  }
427 
432  public function insertDateHeader( &$s, $rc_timestamp ) {
433  # Make date header if necessary
434  $date = $this->getLanguage()->userDate( $rc_timestamp, $this->getUser() );
435  if ( $date != $this->lastdate ) {
436  if ( $this->lastdate != '' ) {
437  $s .= "</ul>\n";
438  }
439  $s .= Xml::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
440  $this->lastdate = $date;
441  $this->rclistOpen = true;
442  }
443  }
444 
450  public function insertLog( &$s, $title, $logtype ) {
451  $page = new LogPage( $logtype );
452  $logname = $page->getName()->setContext( $this->getContext() )->text();
453  $s .= $this->msg( 'parentheses' )->rawParams(
454  $this->linkRenderer->makeKnownLink( $title, $logname )
455  )->escaped();
456  }
457 
463  public function insertDiffHist( &$s, &$rc, $unpatrolled = null ) {
464  # Diff link
465  if (
466  $rc->mAttribs['rc_type'] == RC_NEW ||
467  $rc->mAttribs['rc_type'] == RC_LOG ||
468  $rc->mAttribs['rc_type'] == RC_CATEGORIZE
469  ) {
470  $diffLink = $this->message['diff'];
471  } elseif ( !self::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
472  $diffLink = $this->message['diff'];
473  } else {
474  $query = [
475  'curid' => $rc->mAttribs['rc_cur_id'],
476  'diff' => $rc->mAttribs['rc_this_oldid'],
477  'oldid' => $rc->mAttribs['rc_last_oldid']
478  ];
479 
480  $diffLink = $this->linkRenderer->makeKnownLink(
481  $rc->getTitle(),
482  new HtmlArmor( $this->message['diff'] ),
483  [ 'class' => 'mw-changeslist-diff' ],
484  $query
485  );
486  }
487  if ( $rc->mAttribs['rc_type'] == RC_CATEGORIZE ) {
488  $histLink = $this->message['hist'];
489  } else {
490  $histLink = $this->linkRenderer->makeKnownLink(
491  $rc->getTitle(),
492  new HtmlArmor( $this->message['hist'] ),
493  [ 'class' => 'mw-changeslist-history' ],
494  [
495  'curid' => $rc->mAttribs['rc_cur_id'],
496  'action' => 'history'
497  ]
498  );
499  }
500 
501  $s .= Html::rawElement( 'div', [ 'class' => 'mw-changeslist-links' ],
502  Html::rawElement( 'span', [], $diffLink ) .
503  Html::rawElement( 'span', [], $histLink )
504  ) .
505  ' <span class="mw-changeslist-separator"></span> ';
506  }
507 
515  public function getArticleLink( &$rc, $unpatrolled, $watched ) {
516  $params = [];
517  if ( $rc->getTitle()->isRedirect() ) {
518  $params = [ 'redirect' => 'no' ];
519  }
520 
521  $articlelink = $this->linkRenderer->makeLink(
522  $rc->getTitle(),
523  null,
524  [ 'class' => 'mw-changeslist-title' ],
525  $params
526  );
527  if ( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) {
528  $articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
529  }
530  # To allow for boldening pages watched by this user
531  $articlelink = "<span class=\"mw-title\">{$articlelink}</span>";
532  # RTL/LTR marker
533  $articlelink .= $this->getLanguage()->getDirMark();
534 
535  # TODO: Deprecate the $s argument, it seems happily unused.
536  $s = '';
537  # Avoid PHP 7.1 warning from passing $this by reference
538  $changesList = $this;
539  Hooks::run( 'ChangesListInsertArticleLink',
540  [ &$changesList, &$articlelink, &$s, &$rc, $unpatrolled, $watched ] );
541 
542  return "{$s} {$articlelink}";
543  }
544 
553  public function getTimestamp( $rc ) {
554  // @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
555  return $this->message['semicolon-separator'] . '<span class="mw-changeslist-date">' .
556  htmlspecialchars( $this->getLanguage()->userTime(
557  $rc->mAttribs['rc_timestamp'],
558  $this->getUser()
559  ) ) . '</span> <span class="mw-changeslist-separator"></span> ';
560  }
561 
568  public function insertTimestamp( &$s, $rc ) {
569  $s .= $this->getTimestamp( $rc );
570  }
571 
578  public function insertUserRelatedLinks( &$s, &$rc ) {
579  if ( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
580  $s .= ' <span class="history-deleted">' .
581  $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
582  } else {
583  $s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
584  $rc->mAttribs['rc_user_text'] );
586  $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'],
587  false, 0, null,
588  // The text content of tools is not wrapped with parenthesises or "piped".
589  // This will be handled in CSS (T205581).
590  false
591  );
592  }
593  }
594 
601  public function insertLogEntry( $rc ) {
602  $formatter = LogFormatter::newFromRow( $rc->mAttribs );
603  $formatter->setContext( $this->getContext() );
604  $formatter->setShowUserToolLinks( true );
605  $mark = $this->getLanguage()->getDirMark();
606 
607  return $formatter->getActionText() . " $mark" . $formatter->getComment();
608  }
609 
615  public function insertComment( $rc ) {
616  if ( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
617  return ' <span class="history-deleted">' .
618  $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
619  } else {
620  return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle(),
621  // Whether section links should refer to local page (using default false)
622  false,
623  // wikid to generate links for (using default null) */
624  null,
625  // whether parentheses should be rendered as part of the message
626  false );
627  }
628  }
629 
635  protected function numberofWatchingusers( $count ) {
636  if ( $count <= 0 ) {
637  return '';
638  }
639 
640  return $this->watchMsgCache->getWithSetCallback(
641  "watching-users-msg:$count",
642  function () use ( $count ) {
643  return $this->msg( 'number_of_watching_users_RCview' )
644  ->numParams( $count )->escaped();
645  }
646  );
647  }
648 
655  public static function isDeleted( $rc, $field ) {
656  return ( $rc->mAttribs['rc_deleted'] & $field ) == $field;
657  }
658 
667  public static function userCan( $rc, $field, User $user = null ) {
668  if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
669  return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
670  } else {
671  return Revision::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
672  }
673  }
674 
680  protected function maybeWatchedLink( $link, $watched = false ) {
681  if ( $watched ) {
682  return '<strong class="mw-watched">' . $link . '</strong>';
683  } else {
684  return '<span class="mw-rc-unwatched">' . $link . '</span>';
685  }
686  }
687 
694  public function insertRollback( &$s, &$rc ) {
695  if ( $rc->mAttribs['rc_type'] == RC_EDIT
696  && $rc->mAttribs['rc_this_oldid']
697  && $rc->mAttribs['rc_cur_id']
698  && $rc->getAttribute( 'page_latest' ) == $rc->mAttribs['rc_this_oldid']
699  ) {
700  $title = $rc->getTitle();
703  if ( $title->quickUserCan( 'rollback', $this->getUser() ) ) {
704  $rev = new Revision( [
705  'title' => $title,
706  'id' => $rc->mAttribs['rc_this_oldid'],
707  'user' => $rc->mAttribs['rc_user'],
708  'user_text' => $rc->mAttribs['rc_user_text'],
709  'actor' => $rc->mAttribs['rc_actor'] ?? null,
710  'deleted' => $rc->mAttribs['rc_deleted']
711  ] );
712  $s .= ' ' . Linker::generateRollback( $rev, $this->getContext() );
713  }
714  }
715  }
716 
722  public function getRollback( RecentChange $rc ) {
723  $s = '';
724  $this->insertRollback( $s, $rc );
725  return $s;
726  }
727 
733  public function insertTags( &$s, &$rc, &$classes ) {
734  if ( empty( $rc->mAttribs['ts_tags'] ) ) {
735  return;
736  }
737 
738  list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
739  $rc->mAttribs['ts_tags'],
740  'changeslist',
741  $this->getContext()
742  );
743  $classes = array_merge( $classes, $newClasses );
744  $s .= ' ' . $tagSummary;
745  }
746 
753  public function getTags( RecentChange $rc, array &$classes ) {
754  $s = '';
755  $this->insertTags( $s, $rc, $classes );
756  return $s;
757  }
758 
759  public function insertExtra( &$s, &$rc, &$classes ) {
760  // Empty, used for subclasses to add anything special.
761  }
762 
763  protected function showAsUnpatrolled( RecentChange $rc ) {
764  return self::isUnpatrolled( $rc, $this->getUser() );
765  }
766 
772  public static function isUnpatrolled( $rc, User $user ) {
773  if ( $rc instanceof RecentChange ) {
774  $isPatrolled = $rc->mAttribs['rc_patrolled'];
775  $rcType = $rc->mAttribs['rc_type'];
776  $rcLogType = $rc->mAttribs['rc_log_type'];
777  } else {
778  $isPatrolled = $rc->rc_patrolled;
779  $rcType = $rc->rc_type;
780  $rcLogType = $rc->rc_log_type;
781  }
782 
783  if ( !$isPatrolled ) {
784  if ( $user->useRCPatrol() ) {
785  return true;
786  }
787  if ( $user->useNPPatrol() && $rcType == RC_NEW ) {
788  return true;
789  }
790  if ( $user->useFilePatrol() && $rcLogType == 'upload' ) {
791  return true;
792  }
793  }
794 
795  return false;
796  }
797 
807  protected function isCategorizationWithoutRevision( $rcObj ) {
808  return intval( $rcObj->getAttribute( 'rc_type' ) ) === RC_CATEGORIZE
809  && intval( $rcObj->getAttribute( 'rc_this_oldid' ) ) === 0;
810  }
811 
817  protected function getDataAttributes( RecentChange $rc ) {
818  $attrs = [];
819 
820  $type = $rc->getAttribute( 'rc_source' );
821  switch ( $type ) {
824  $attrs['data-mw-revid'] = $rc->mAttribs['rc_this_oldid'];
825  break;
827  $attrs['data-mw-logid'] = $rc->mAttribs['rc_logid'];
828  $attrs['data-mw-logaction'] =
829  $rc->mAttribs['rc_log_type'] . '/' . $rc->mAttribs['rc_log_action'];
830  break;
831  }
832 
833  $attrs[ 'data-mw-ts' ] = $rc->getAttribute( 'rc_timestamp' );
834 
835  return $attrs;
836  }
837 
845  public function setChangeLinePrefixer( callable $prefixer ) {
846  $this->changeLinePrefixer = $prefixer;
847  }
848 }
$filter
$filter
Definition: profileinfo.php:341
Revision\DELETED_USER
const DELETED_USER
Definition: Revision.php:48
ChangesList\endRecentChangesList
endRecentChangesList()
Returns text for the end of RC.
Definition: ChangesList.php:391
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:33
ContextSource\getConfig
getConfig()
Definition: ContextSource.php:63
$user
return true to allow those checks to and false if checking is done & $user
Definition: hooks.txt:1476
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:615
ChangesList\setWatchlistDivs
setWatchlistDivs( $value=true)
Sets the list to use a "<li class='watchlist-(namespace)-(page)'>" tag.
Definition: ChangesList.php:145
Revision\DELETED_COMMENT
const DELETED_COMMENT
Definition: Revision.php:47
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
ChangesList\setChangeLinePrefixer
setChangeLinePrefixer(callable $prefixer)
Sets the callable that generates a change line prefix added to the beginning of each line.
Definition: ChangesList.php:845
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:1244
IContextSource\getSkin
getSkin()
Linker\userLink
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
Definition: Linker.php:892
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:33
ContextSource\msg
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:168
RecentChange
Utility class for creating new RC entries.
Definition: RecentChange.php:69
ChangesList\$watchMsgCache
MapCacheLRU $watchMsgCache
Definition: ChangesList.php:48
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:931
$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 When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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:780
ChangesList\maybeWatchedLink
maybeWatchedLink( $link, $watched=false)
Definition: ChangesList.php:680
RC_LOG
const RC_LOG
Definition: Defines.php:144
$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:1476
ChangesList\insertLog
insertLog(&$s, $title, $logtype)
Definition: ChangesList.php:450
ChangesList\getTags
getTags(RecentChange $rc, array &$classes)
Definition: ChangesList.php:753
$params
$params
Definition: styleTest.css.php:44
RC_EDIT
const RC_EDIT
Definition: Defines.php:142
ChangesList\getHighlightsContainerDiv
getHighlightsContainerDiv()
Get the container for highlights that are used in the new StructuredFilters system.
Definition: ChangesList.php:122
$s
$s
Definition: mergeMessageFileList.php:186
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:371
ContextSource\getUser
getUser()
Definition: ContextSource.php:120
ChangesList\$lastdate
$lastdate
Definition: ChangesList.php:37
RecentChange\SRC_LOG
const SRC_LOG
Definition: RecentChange.php:74
ChangesList\isDeleted
static isDeleted( $rc, $field)
Determine if said field of a revision is hidden.
Definition: ChangesList.php:655
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()
Definition: ContextSource.php:128
Revision
Definition: Revision.php:40
ChangesList\insertDateHeader
insertDateHeader(&$s, $rc_timestamp)
Definition: ChangesList.php:432
ChangesList\$filterGroups
array $filterGroups
Definition: ChangesList.php:58
$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:1588
$wgRecentChangesFlags
$wgRecentChangesFlags
Flags (letter symbols) shown in recent changes and watchlist to indicate certain types of edits.
Definition: DefaultSettings.php:7090
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:925
Linker\generateRollback
static generateRollback( $rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
Definition: Linker.php:1750
LogFormatter\newFromRow
static newFromRow( $row)
Handy shortcut for constructing a formatter directly from database row.
Definition: LogFormatter.php:70
ChangesList\insertLogEntry
insertLogEntry( $rc)
Insert a formatted action.
Definition: ChangesList.php:601
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:153
ChangesList\insertTags
insertTags(&$s, &$rc, &$classes)
Definition: ChangesList.php:733
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:37
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
$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 When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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:780
ChangesList\flag
static flag( $flag, IContextSource $context=null)
Make an "<abbr>" element for a given change flag.
Definition: ChangesList.php:253
ChangesList\CSS_CLASS_PREFIX
const CSS_CLASS_PREFIX
Definition: ChangesList.php:29
MessageLocalizer\msg
msg( $key)
This is the method for getting translated interface messages.
RecentChange\SRC_EDIT
const SRC_EDIT
Definition: RecentChange.php:72
RecentChange\SRC_NEW
const SRC_NEW
Definition: RecentChange.php:73
array
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
ChangesList\insertUserRelatedLinks
insertUserRelatedLinks(&$s, &$rc)
Insert links to user page, user talk page and eventually a blocking link.
Definition: ChangesList.php:578
ContextSource\setContext
setContext(IContextSource $context)
Definition: ContextSource.php:55
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:722
ChangesList\getArticleLink
getArticleLink(&$rc, $unpatrolled, $watched)
Definition: ChangesList.php:515
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:86
ChangesList\$rclistOpen
$rclistOpen
Definition: ChangesList.php:41
ChangesList\$changeLinePrefixer
callable $changeLinePrefixer
Definition: ChangesList.php:45
ChangesList\getDataAttributes
getDataAttributes(RecentChange $rc)
Get recommended data attributes for a change line.
Definition: ChangesList.php:817
EnhancedChangesList
Definition: EnhancedChangesList.php:23
OldChangesList
Definition: OldChangesList.php:25
$value
$value
Definition: styleTest.css.php:49
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:1480
ChangesList\insertTimestamp
insertTimestamp(&$s, $rc)
Insert time timestamp string from $rc into $s.
Definition: ChangesList.php:568
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:409
ChangesList\numberofWatchingusers
numberofWatchingusers( $count)
Returns the string which indicates the number of watching users.
Definition: ChangesList.php:635
ChangesList\showAsUnpatrolled
showAsUnpatrolled(RecentChange $rc)
Definition: ChangesList.php:763
ChangesList\showCharacterDifference
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
Definition: ChangesList.php:317
IContextSource\getUser
getUser()
RC_NEW
const RC_NEW
Definition: Defines.php:143
ChangesList\preCacheMessages
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often,...
Definition: ChangesList.php:161
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:430
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 use $formDescriptor instead 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:2154
ChangesList\$watchlist
$watchlist
Definition: ChangesList.php:36
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:197
ChangesList\__construct
__construct( $obj, array $filterGroups=[])
Definition: ChangesList.php:64
RecentChange\getAttribute
getAttribute( $name)
Get an attribute value.
Definition: RecentChange.php:1078
text
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
Definition: All_system_messages.txt:1267
ChangesList\recentChangesFlags
recentChangesFlags( $flags, $nothing="\u{00A0}")
Returns the appropriate flags for new page, minor change and patrolling.
Definition: ChangesList.php:178
ChangesList\beginRecentChangesList
beginRecentChangesList()
Returns text for the start of the tabular part of RC.
Definition: ChangesList.php:286
ChangesList\insertDiffHist
insertDiffHist(&$s, &$rc, $unpatrolled=null)
Definition: ChangesList.php:463
$rows
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction $rows
Definition: hooks.txt:2636
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:303
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:807
$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:1769
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
$link
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition: hooks.txt:3053
ChangesList\getTimestamp
getTimestamp( $rc)
Get the timestamp from $rc formatted with current user's settings and a separator.
Definition: ChangesList.php:553
IContextSource\getRequest
getRequest()
ChangesList
Definition: ChangesList.php:28
ChangesList\$skin
Skin $skin
Definition: ChangesList.php:34
RC_CATEGORIZE
const RC_CATEGORIZE
Definition: Defines.php:146
ChangesList\isUnpatrolled
static isUnpatrolled( $rc, User $user)
Definition: ChangesList.php:772
$f
$f
Definition: router.php:79
ChangesList\$rc_cache
$rc_cache
Definition: ChangesList.php:39
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:38
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 use $formDescriptor instead 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
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:48
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:38
ChangeTags\formatSummaryRow
static formatSummaryRow( $tags, $page, IContextSource $context=null)
Creates HTML for the given tags.
Definition: ChangeTags.php:93
Revision\DELETED_TEXT
const DELETED_TEXT
Definition: Revision.php:46
Language
Internationalisation code.
Definition: Language.php:36
ChangesList\getHTMLClassesForFilters
getHTMLClassesForFilters( $rc)
Get an array of CSS classes attributed to filters for this row.
Definition: ChangesList.php:228
ChangesList\recentChangesLine
recentChangesLine(&$rc, $watched=false, $linenumber=null)
Format a line.
Definition: ChangesList.php:112
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:667
ChangesList\insertExtra
insertExtra(&$s, &$rc, &$classes)
Definition: ChangesList.php:759
ChangesList\insertRollback
insertRollback(&$s, &$rc)
Insert a rollback link.
Definition: ChangesList.php:694
IContextSource\getLanguage
getLanguage()
ChangesList\$linkRenderer
LinkRenderer $linkRenderer
Definition: ChangesList.php:53
$type
$type
Definition: testCompression.php:48