MediaWiki  1.29.2
EnhancedChangesList.php
Go to the documentation of this file.
1 <?php
24 
28  protected $cacheEntryFactory;
29 
33  protected $rc_cache;
34 
38  protected $templateParser;
39 
45  public function __construct( $obj, array $filterGroups = [] ) {
46  if ( $obj instanceof Skin ) {
47  // @todo: deprecate constructing with Skin
48  $context = $obj->getContext();
49  } else {
50  if ( !$obj instanceof IContextSource ) {
51  throw new MWException( 'EnhancedChangesList must be constructed with a '
52  . 'context source or skin.' );
53  }
54 
55  $context = $obj;
56  }
57 
58  parent::__construct( $context, $filterGroups );
59 
60  // message is set by the parent ChangesList class
61  $this->cacheEntryFactory = new RCCacheEntryFactory(
62  $context,
63  $this->message,
64  $this->linkRenderer
65  );
66  $this->templateParser = new TemplateParser();
67  }
68 
73  public function beginRecentChangesList() {
74  $this->rc_cache = [];
75  $this->rcMoveIndex = 0;
76  $this->rcCacheIndex = 0;
77  $this->lastdate = '';
78  $this->rclistOpen = false;
79  $this->getOutput()->addModuleStyles( [
80  'mediawiki.special.changeslist',
81  'mediawiki.special.changeslist.enhanced',
82  ] );
83  $this->getOutput()->addModules( [
84  'jquery.makeCollapsible',
85  'mediawiki.icon',
86  ] );
87 
88  return '<div class="mw-changeslist">';
89  }
90 
100  public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
101 
102  $date = $this->getLanguage()->userDate(
103  $rc->mAttribs['rc_timestamp'],
104  $this->getUser()
105  );
106 
107  $ret = '';
108 
109  # If it's a new day, add the headline and flush the cache
110  if ( $date != $this->lastdate ) {
111  # Process current cache
112  $ret = $this->recentChangesBlock();
113  $this->rc_cache = [];
114  $ret .= Xml::element( 'h4', null, $date ) . "\n";
115  $this->lastdate = $date;
116  }
117 
118  $cacheEntry = $this->cacheEntryFactory->newFromRecentChange( $rc, $watched );
119  $this->addCacheEntry( $cacheEntry );
120 
121  return $ret;
122  }
123 
130  protected function addCacheEntry( RCCacheEntry $cacheEntry ) {
131  $cacheGroupingKey = $this->makeCacheGroupingKey( $cacheEntry );
132 
133  if ( !isset( $this->rc_cache[$cacheGroupingKey] ) ) {
134  $this->rc_cache[$cacheGroupingKey] = [];
135  }
136 
137  array_push( $this->rc_cache[$cacheGroupingKey], $cacheEntry );
138  }
139 
147  protected function makeCacheGroupingKey( RCCacheEntry $cacheEntry ) {
148  $title = $cacheEntry->getTitle();
149  $cacheGroupingKey = $title->getPrefixedDBkey();
150 
151  $type = $cacheEntry->mAttribs['rc_type'];
152 
153  if ( $type == RC_LOG ) {
154  // Group by log type
155  $cacheGroupingKey = SpecialPage::getTitleFor(
156  'Log',
157  $cacheEntry->mAttribs['rc_log_type']
158  )->getPrefixedDBkey();
159  }
160 
161  return $cacheGroupingKey;
162  }
163 
170  protected function recentChangesBlockGroup( $block ) {
171  $recentChangesFlags = $this->getConfig()->get( 'RecentChangesFlags' );
172 
173  # Add the namespace and title of the block as part of the class
174  $tableClasses = [ 'mw-collapsible', 'mw-collapsed', 'mw-enhanced-rc' ];
175  if ( $block[0]->mAttribs['rc_log_type'] ) {
176  # Log entry
177  $tableClasses[] = Sanitizer::escapeClass( 'mw-changeslist-log-'
178  . $block[0]->mAttribs['rc_log_type'] );
179  } else {
180  $tableClasses[] = Sanitizer::escapeClass( 'mw-changeslist-ns'
181  . $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
182  }
183  if ( $block[0]->watched
184  && $block[0]->mAttribs['rc_timestamp'] >= $block[0]->watched
185  ) {
186  $tableClasses[] = 'mw-changeslist-line-watched';
187  } else {
188  $tableClasses[] = 'mw-changeslist-line-not-watched';
189  }
190 
191  # Collate list of users
192  $userlinks = [];
193  # Other properties
194  $curId = 0;
195  # Some catalyst variables...
196  $namehidden = true;
197  $allLogs = true;
198  $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
199 
200  # Default values for RC flags
201  $collectedRcFlags = [];
202  foreach ( $recentChangesFlags as $key => $value ) {
203  $flagGrouping = ( isset( $recentChangesFlags[$key]['grouping'] ) ?
204  $recentChangesFlags[$key]['grouping'] : 'any' );
205  switch ( $flagGrouping ) {
206  case 'all':
207  $collectedRcFlags[$key] = true;
208  break;
209  case 'any':
210  $collectedRcFlags[$key] = false;
211  break;
212  default:
213  throw new DomainException( "Unknown grouping type \"{$flagGrouping}\"" );
214  }
215  }
216  foreach ( $block as $rcObj ) {
217  // If all log actions to this page were hidden, then don't
218  // give the name of the affected page for this block!
219  if ( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
220  $namehidden = false;
221  }
222  $u = $rcObj->userlink;
223  if ( !isset( $userlinks[$u] ) ) {
224  $userlinks[$u] = 0;
225  }
226  if ( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
227  $allLogs = false;
228  }
229  # Get the latest entry with a page_id and oldid
230  # since logs may not have these.
231  if ( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
232  $curId = $rcObj->mAttribs['rc_cur_id'];
233  }
234 
235  $userlinks[$u]++;
236  }
237 
238  # Sort the list and convert to text
239  krsort( $userlinks );
240  asort( $userlinks );
241  $users = [];
242  foreach ( $userlinks as $userlink => $count ) {
243  $text = $userlink;
244  $text .= $this->getLanguage()->getDirMark();
245  if ( $count > 1 ) {
246  // @todo FIXME: Hardcoded '×'. Should be a message.
247  $formattedCount = $this->getLanguage()->formatNum( $count ) . '×';
248  $text .= ' ' . $this->msg( 'parentheses' )->rawParams( $formattedCount )->escaped();
249  }
250  array_push( $users, $text );
251  }
252 
253  # Article link
254  $articleLink = '';
255  $revDeletedMsg = false;
256  if ( $namehidden ) {
257  $revDeletedMsg = $this->msg( 'rev-deleted-event' )->escaped();
258  } elseif ( $allLogs ) {
259  $articleLink = $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
260  } else {
261  $articleLink = $this->getArticleLink( $block[0], $block[0]->unpatrolled, $block[0]->watched );
262  }
263 
264  $queryParams['curid'] = $curId;
265 
266  # Sub-entries
267  $lines = [];
268  foreach ( $block as $i => $rcObj ) {
269  $line = $this->getLineData( $block, $rcObj, $queryParams );
270  if ( !$line ) {
271  // completely ignore this RC entry if we don't want to render it
272  unset( $block[$i] );
273  continue;
274  }
275 
276  // Roll up flags
277  foreach ( $line['recentChangesFlagsRaw'] as $key => $value ) {
278  $flagGrouping = ( isset( $recentChangesFlags[$key]['grouping'] ) ?
279  $recentChangesFlags[$key]['grouping'] : 'any' );
280  switch ( $flagGrouping ) {
281  case 'all':
282  if ( !$value ) {
283  $collectedRcFlags[$key] = false;
284  }
285  break;
286  case 'any':
287  if ( $value ) {
288  $collectedRcFlags[$key] = true;
289  }
290  break;
291  default:
292  throw new DomainException( "Unknown grouping type \"{$flagGrouping}\"" );
293  }
294  }
295 
296  $lines[] = $line;
297  }
298 
299  // Further down are some assumptions that $block is a 0-indexed array
300  // with (count-1) as last key. Let's make sure it is.
301  $block = array_values( $block );
302 
303  if ( empty( $block ) || !$lines ) {
304  // if we can't show anything, don't display this block altogether
305  return '';
306  }
307 
308  $logText = $this->getLogText( $block, $queryParams, $allLogs,
309  $collectedRcFlags['newpage'], $namehidden
310  );
311 
312  # Character difference (does not apply if only log items)
313  $charDifference = false;
314  if ( $RCShowChangedSize && !$allLogs ) {
315  $last = 0;
316  $first = count( $block ) - 1;
317  # Some events (like logs and category changes) have an "empty" size, so we need to skip those...
318  while ( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) {
319  $last++;
320  }
321  while ( $last < $first && $block[$first]->mAttribs['rc_old_len'] === null ) {
322  $first--;
323  }
324  # Get net change
325  $charDifference = $this->formatCharacterDifference( $block[$first], $block[$last] );
326  }
327 
328  $numberofWatchingusers = $this->numberofWatchingusers( $block[0]->numberofWatchingusers );
329  $usersList = $this->msg( 'brackets' )->rawParams(
330  implode( $this->message['semicolon-separator'], $users )
331  )->escaped();
332 
333  $templateParams = [
334  'articleLink' => $articleLink,
335  'charDifference' => $charDifference,
336  'collectedRcFlags' => $this->recentChangesFlags( $collectedRcFlags ),
337  'languageDirMark' => $this->getLanguage()->getDirMark(),
338  'lines' => $lines,
339  'logText' => $logText,
340  'numberofWatchingusers' => $numberofWatchingusers,
341  'rev-deleted-event' => $revDeletedMsg,
342  'tableClasses' => $tableClasses,
343  'timestamp' => $block[0]->timestamp,
344  'users' => $usersList,
345  ];
346 
347  $this->rcCacheIndex++;
348 
349  return $this->templateParser->processTemplate(
350  'EnhancedChangesListGroup',
351  $templateParams
352  );
353  }
354 
364  protected function getLineData( array $block, RCCacheEntry $rcObj, array $queryParams = [] ) {
365  $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
366 
367  $type = $rcObj->mAttribs['rc_type'];
368  $data = [];
369  $lineParams = [];
370 
371  $classes = [ 'mw-enhanced-rc' ];
372  if ( $rcObj->watched
373  && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
374  ) {
375  $classes[] = 'mw-enhanced-watched';
376  }
377  $classes = array_merge( $classes, $this->getHTMLClassesForFilters( $rcObj ) );
378 
379  $separator = ' <span class="mw-changeslist-separator">. .</span> ';
380 
381  $data['recentChangesFlags'] = [
382  'newpage' => $type == RC_NEW,
383  'minor' => $rcObj->mAttribs['rc_minor'],
384  'unpatrolled' => $rcObj->unpatrolled,
385  'bot' => $rcObj->mAttribs['rc_bot'],
386  ];
387 
388  $params = $queryParams;
389 
390  if ( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
391  $params['oldid'] = $rcObj->mAttribs['rc_this_oldid'];
392  }
393 
394  # Log timestamp
395  if ( $type == RC_LOG ) {
396  $link = $rcObj->timestamp;
397  # Revision link
398  } elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
399  $link = '<span class="history-deleted">' . $rcObj->timestamp . '</span> ';
400  } else {
401  $link = $this->linkRenderer->makeKnownLink(
402  $rcObj->getTitle(),
403  new HtmlArmor( $rcObj->timestamp ),
404  [],
405  $params
406  );
407  if ( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
408  $link = '<span class="history-deleted">' . $link . '</span> ';
409  }
410  }
411  $data['timestampLink'] = $link;
412 
413  $currentAndLastLinks = '';
414  if ( !$type == RC_LOG || $type == RC_NEW ) {
415  $currentAndLastLinks .= ' ' . $this->msg( 'parentheses' )->rawParams(
416  $rcObj->curlink .
417  $this->message['pipe-separator'] .
418  $rcObj->lastlink
419  )->escaped();
420  }
421  $data['currentAndLastLinks'] = $currentAndLastLinks;
422  $data['separatorAfterCurrentAndLastLinks'] = $separator;
423 
424  # Character diff
425  if ( $RCShowChangedSize ) {
426  $cd = $this->formatCharacterDifference( $rcObj );
427  if ( $cd !== '' ) {
428  $data['characterDiff'] = $cd;
429  $data['separatorAfterCharacterDiff'] = $separator;
430  }
431  }
432 
433  if ( $rcObj->mAttribs['rc_type'] == RC_LOG ) {
434  $data['logEntry'] = $this->insertLogEntry( $rcObj );
435  } elseif ( $this->isCategorizationWithoutRevision( $rcObj ) ) {
436  $data['comment'] = $this->insertComment( $rcObj );
437  } else {
438  # User links
439  $data['userLink'] = $rcObj->userlink;
440  $data['userTalkLink'] = $rcObj->usertalklink;
441  $data['comment'] = $this->insertComment( $rcObj );
442  }
443 
444  # Rollback
445  $data['rollback'] = $this->getRollback( $rcObj );
446 
447  # Tags
448  $data['tags'] = $this->getTags( $rcObj, $classes );
449 
450  // give the hook a chance to modify the data
451  $success = Hooks::run( 'EnhancedChangesListModifyLineData',
452  [ $this, &$data, $block, $rcObj, &$classes ] );
453  if ( !$success ) {
454  // skip entry if hook aborted it
455  return [];
456  }
457 
458  $lineParams['recentChangesFlagsRaw'] = [];
459  if ( isset( $data['recentChangesFlags'] ) ) {
460  $lineParams['recentChangesFlags'] = $this->recentChangesFlags( $data['recentChangesFlags'] );
461  # FIXME: This is used by logic, don't return it in the template params.
462  $lineParams['recentChangesFlagsRaw'] = $data['recentChangesFlags'];
463  unset( $data['recentChangesFlags'] );
464  }
465 
466  if ( isset( $data['timestampLink'] ) ) {
467  $lineParams['timestampLink'] = $data['timestampLink'];
468  unset( $data['timestampLink'] );
469  }
470 
471  $lineParams['classes'] = array_values( $classes );
472 
473  // everything else: makes it easier for extensions to add or remove data
474  $lineParams['data'] = array_values( $data );
475 
476  return $lineParams;
477  }
478 
489  protected function getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden ) {
490  if ( empty( $block ) ) {
491  return '';
492  }
493 
494  # Changes message
495  static $nchanges = [];
496  static $sinceLastVisitMsg = [];
497 
498  $n = count( $block );
499  if ( !isset( $nchanges[$n] ) ) {
500  $nchanges[$n] = $this->msg( 'nchanges' )->numParams( $n )->escaped();
501  }
502 
503  $sinceLast = 0;
504  $unvisitedOldid = null;
506  foreach ( $block as $rcObj ) {
507  // Same logic as below inside main foreach
508  if ( $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched ) {
509  $sinceLast++;
510  $unvisitedOldid = $rcObj->mAttribs['rc_last_oldid'];
511  }
512  }
513  if ( !isset( $sinceLastVisitMsg[$sinceLast] ) ) {
514  $sinceLastVisitMsg[$sinceLast] =
515  $this->msg( 'enhancedrc-since-last-visit' )->numParams( $sinceLast )->escaped();
516  }
517 
518  $currentRevision = 0;
519  foreach ( $block as $rcObj ) {
520  if ( !$currentRevision ) {
521  $currentRevision = $rcObj->mAttribs['rc_this_oldid'];
522  }
523  }
524 
525  # Total change link
526  $links = [];
528  $block0 = $block[0];
529  $last = $block[count( $block ) - 1];
530  if ( !$allLogs ) {
531  if ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ||
532  $isnew ||
533  $rcObj->mAttribs['rc_type'] == RC_CATEGORIZE
534  ) {
535  $links['total-changes'] = $nchanges[$n];
536  } else {
537  $links['total-changes'] = $this->linkRenderer->makeKnownLink(
538  $block0->getTitle(),
539  new HtmlArmor( $nchanges[$n] ),
540  [ 'class' => 'mw-changeslist-groupdiff' ],
541  $queryParams + [
542  'diff' => $currentRevision,
543  'oldid' => $last->mAttribs['rc_last_oldid'],
544  ]
545  );
546  if ( $sinceLast > 0 && $sinceLast < $n ) {
547  $links['total-changes-since-last'] = $this->linkRenderer->makeKnownLink(
548  $block0->getTitle(),
549  new HtmlArmor( $sinceLastVisitMsg[$sinceLast] ),
550  [ 'class' => 'mw-changeslist-groupdiff' ],
551  $queryParams + [
552  'diff' => $currentRevision,
553  'oldid' => $unvisitedOldid,
554  ]
555  );
556  }
557  }
558  }
559 
560  # History
561  if ( $allLogs || $rcObj->mAttribs['rc_type'] == RC_CATEGORIZE ) {
562  // don't show history link for logs
563  } elseif ( $namehidden || !$block0->getTitle()->exists() ) {
564  $links['history'] = $this->message['enhancedrc-history'];
565  } else {
566  $params = $queryParams;
567  $params['action'] = 'history';
568 
569  $links['history'] = $this->linkRenderer->makeKnownLink(
570  $block0->getTitle(),
571  new HtmlArmor( $this->message['enhancedrc-history'] ),
572  [ 'class' => 'mw-changeslist-history' ],
573  $params
574  );
575  }
576 
577  # Allow others to alter, remove or add to these links
578  Hooks::run( 'EnhancedChangesList::getLogText',
579  [ $this, &$links, $block ] );
580 
581  if ( !$links ) {
582  return '';
583  }
584 
585  $logtext = implode( $this->message['pipe-separator'], $links );
586  $logtext = $this->msg( 'parentheses' )->rawParams( $logtext )->escaped();
587  return ' ' . $logtext;
588  }
589 
596  protected function recentChangesBlockLine( $rcObj ) {
597  $data = [];
598 
599  $query['curid'] = $rcObj->mAttribs['rc_cur_id'];
600 
601  $type = $rcObj->mAttribs['rc_type'];
602  $logType = $rcObj->mAttribs['rc_log_type'];
603  $classes = $this->getHTMLClasses( $rcObj, $rcObj->watched );
604  $classes[] = 'mw-enhanced-rc';
605 
606  if ( $logType ) {
607  # Log entry
608  $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-' . $logType );
609  } else {
610  $classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' .
611  $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
612  }
613 
614  # Flag and Timestamp
615  $data['recentChangesFlags'] = [
616  'newpage' => $type == RC_NEW,
617  'minor' => $rcObj->mAttribs['rc_minor'],
618  'unpatrolled' => $rcObj->unpatrolled,
619  'bot' => $rcObj->mAttribs['rc_bot'],
620  ];
621  // timestamp is not really a link here, but is called timestampLink
622  // for consistency with EnhancedChangesListModifyLineData
623  $data['timestampLink'] = $rcObj->timestamp;
624 
625  # Article or log link
626  if ( $logType ) {
627  $logPage = new LogPage( $logType );
628  $logTitle = SpecialPage::getTitleFor( 'Log', $logType );
629  $logName = $logPage->getName()->text();
630  $data['logLink'] = $this->msg( 'parentheses' )
631  ->rawParams(
632  $this->linkRenderer->makeKnownLink( $logTitle, $logName )
633  )->escaped();
634  } else {
635  $data['articleLink'] = $this->getArticleLink( $rcObj, $rcObj->unpatrolled, $rcObj->watched );
636  }
637 
638  # Diff and hist links
639  if ( $type != RC_LOG && $type != RC_CATEGORIZE ) {
640  $query['action'] = 'history';
641  $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query );
642  }
643  $data['separatorAfterLinks'] = ' <span class="mw-changeslist-separator">. .</span> ';
644 
645  # Character diff
646  if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
647  $cd = $this->formatCharacterDifference( $rcObj );
648  if ( $cd !== '' ) {
649  $data['characterDiff'] = $cd;
650  $data['separatorAftercharacterDiff'] = ' <span class="mw-changeslist-separator">. .</span> ';
651  }
652  }
653 
654  if ( $type == RC_LOG ) {
655  $data['logEntry'] = $this->insertLogEntry( $rcObj );
656  } elseif ( $this->isCategorizationWithoutRevision( $rcObj ) ) {
657  $data['comment'] = $this->insertComment( $rcObj );
658  } else {
659  $data['userLink'] = $rcObj->userlink;
660  $data['userTalkLink'] = $rcObj->usertalklink;
661  $data['comment'] = $this->insertComment( $rcObj );
662  if ( $type == RC_CATEGORIZE ) {
663  $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query );
664  }
665  $data['rollback'] = $this->getRollback( $rcObj );
666  }
667 
668  # Tags
669  $data['tags'] = $this->getTags( $rcObj, $classes );
670 
671  # Show how many people are watching this if enabled
672  $data['watchingUsers'] = $this->numberofWatchingusers( $rcObj->numberofWatchingusers );
673 
674  // give the hook a chance to modify the data
675  $success = Hooks::run( 'EnhancedChangesListModifyBlockLineData',
676  [ $this, &$data, $rcObj ] );
677  if ( !$success ) {
678  // skip entry if hook aborted it
679  return '';
680  }
681 
682  $line = Html::openElement( 'table', [ 'class' => $classes ] ) .
683  Html::openElement( 'tr' );
684  $line .= '<td class="mw-enhanced-rc"><span class="mw-enhancedchanges-arrow-space"></span>';
685 
686  if ( isset( $data['recentChangesFlags'] ) ) {
687  $line .= $this->recentChangesFlags( $data['recentChangesFlags'] );
688  unset( $data['recentChangesFlags'] );
689  }
690 
691  if ( isset( $data['timestampLink'] ) ) {
692  $line .= '&#160;' . $data['timestampLink'];
693  unset( $data['timestampLink'] );
694  }
695  $line .= '&#160;</td><td>';
696 
697  // everything else: makes it easier for extensions to add or remove data
698  $line .= implode( '', $data );
699 
700  $line .= "</td></tr></table>\n";
701 
702  return $line;
703  }
704 
715  public function getDiffHistLinks( RCCacheEntry $rc, array $query ) {
716  $pageTitle = $rc->getTitle();
717  if ( $rc->getAttribute( 'rc_type' ) == RC_CATEGORIZE ) {
718  // For categorizations we must swap the category title with the page title!
719  $pageTitle = Title::newFromID( $rc->getAttribute( 'rc_cur_id' ) );
720  }
721 
722  $retVal = ' ' . $this->msg( 'parentheses' )
723  ->rawParams( $rc->difflink . $this->message['pipe-separator']
724  . $this->linkRenderer->makeKnownLink(
725  $pageTitle,
726  new HtmlArmor( $this->message['hist'] ),
727  [ 'class' => 'mw-changeslist-history' ],
728  $query
729  ) )->escaped();
730  return $retVal;
731  }
732 
739  protected function recentChangesBlock() {
740  if ( count( $this->rc_cache ) == 0 ) {
741  return '';
742  }
743 
744  $blockOut = '';
745  foreach ( $this->rc_cache as $block ) {
746  if ( count( $block ) < 2 ) {
747  $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
748  } else {
749  $blockOut .= $this->recentChangesBlockGroup( $block );
750  }
751  }
752 
753  return '<div>' . $blockOut . '</div>';
754  }
755 
761  public function endRecentChangesList() {
762  return $this->recentChangesBlock() . '</div>';
763  }
764 }
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:34
ContextSource\getConfig
getConfig()
Get the Config object.
Definition: ContextSource.php:68
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:28
EnhancedChangesList\recentChangesLine
recentChangesLine(&$rc, $watched=false, $linenumber=null)
Format a line for enhanced recentchange (aka with javascript and block of lines).
Definition: EnhancedChangesList.php:100
ChangesList\insertComment
insertComment( $rc)
Insert a formatted comment.
Definition: ChangesList.php:553
ContextSource\msg
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:187
captcha-old.count
count
Definition: captcha-old.py:225
$last
$last
Definition: profileinfo.php:415
ChangesList\maybeWatchedLink
maybeWatchedLink( $link, $watched=false)
Definition: ChangesList.php:611
RC_LOG
const RC_LOG
Definition: Defines.php:142
EnhancedChangesList\getDiffHistLinks
getDiffHistLinks(RCCacheEntry $rc, array $query)
Returns value to be used in 'historyLink' element of $data param in EnhancedChangesListModifyBlockLin...
Definition: EnhancedChangesList.php:715
ChangesList\getTags
getTags(RecentChange $rc, array &$classes)
Definition: ChangesList.php:683
$params
$params
Definition: styleTest.css.php:40
EnhancedChangesList\makeCacheGroupingKey
makeCacheGroupingKey(RCCacheEntry $cacheEntry)
Definition: EnhancedChangesList.php:147
link
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template to be included in the link
Definition: hooks.txt:2929
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition: SpecialPage.php:82
RCCacheEntryFactory
Definition: RCCacheEntryFactory.php:24
$success
$success
Definition: NoLocalSettings.php:44
$type
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Definition: hooks.txt:2536
ChangesList\formatCharacterDifference
formatCharacterDifference(RecentChange $old, RecentChange $new=null)
Format the character difference of one or several changes.
Definition: ChangesList.php:335
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:133
ChangesList\isDeleted
static isDeleted( $rc, $field)
Determine if said field of a revision is hidden.
Definition: ChangesList.php:586
EnhancedChangesList\$cacheEntryFactory
RCCacheEntryFactory $cacheEntryFactory
Definition: EnhancedChangesList.php:28
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
ContextSource\getLanguage
getLanguage()
Get the Language object.
Definition: ContextSource.php:143
EnhancedChangesList\getLineData
getLineData(array $block, RCCacheEntry $rcObj, array $queryParams=[])
Definition: EnhancedChangesList.php:364
ChangesList\$filterGroups
array $filterGroups
Definition: ChangesList.php:55
$query
null for the wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1572
EnhancedChangesList\endRecentChangesList
endRecentChangesList()
Returns text for the end of RC If enhanced RC is in use, returns pretty much all the text.
Definition: EnhancedChangesList.php:761
MWException
MediaWiki exception.
Definition: MWException.php:26
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:934
ChangesList\insertLogEntry
insertLogEntry( $rc)
Insert a formatted action.
Definition: ChangesList.php:539
ContextSource\getOutput
getOutput()
Get the OutputPage object.
Definition: ContextSource.php:123
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:31
EnhancedChangesList\beginRecentChangesList
beginRecentChangesList()
Add the JavaScript file for enhanced changeslist.
Definition: EnhancedChangesList.php:73
Xml\element
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:39
message
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a message
Definition: hooks.txt:2114
$lines
$lines
Definition: router.php:67
EnhancedChangesList\recentChangesBlockGroup
recentChangesBlockGroup( $block)
Enhanced RC group.
Definition: EnhancedChangesList.php:170
EnhancedChangesList\__construct
__construct( $obj, array $filterGroups=[])
Definition: EnhancedChangesList.php:45
ChangesList\getRollback
getRollback(RecentChange $rc)
Definition: ChangesList.php:652
LogPage\DELETED_ACTION
const DELETED_ACTION
Definition: LogPage.php:32
ChangesList\getArticleLink
getArticleLink(&$rc, $unpatrolled, $watched)
Definition: ChangesList.php:460
$line
$line
Definition: cdb.php:58
EnhancedChangesList
Definition: EnhancedChangesList.php:23
EnhancedChangesList\getLogText
getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden)
Generates amount of changes (linking to diff ) & link to history.
Definition: EnhancedChangesList.php:489
$value
$value
Definition: styleTest.css.php:45
EnhancedChangesList\$rc_cache
array $rc_cache
Array of array of RCCacheEntry.
Definition: EnhancedChangesList.php:33
EnhancedChangesList\$templateParser
TemplateParser $templateParser
Definition: EnhancedChangesList.php:38
ChangesList\numberofWatchingusers
numberofWatchingusers( $count)
Returns the string which indicates the number of watching users.
Definition: ChangesList.php:567
EnhancedChangesList\recentChangesBlock
recentChangesBlock()
If enhanced RC is in use, this function takes the previously cached RC lines, arranges them,...
Definition: EnhancedChangesList.php:739
$ret
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Definition: hooks.txt:1956
RC_NEW
const RC_NEW
Definition: Defines.php:141
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:55
ChangesList\getHTMLClasses
getHTMLClasses( $rc, $watched)
Get an array of default HTML class attributes for the change.
Definition: ChangesList.php:171
RecentChange\getAttribute
getAttribute( $name)
Get an attribute value.
Definition: RecentChange.php:923
RCCacheEntry
Definition: RCCacheEntry.php:21
EnhancedChangesList\recentChangesBlockLine
recentChangesBlockLine( $rcObj)
Enhanced RC ungrouped line.
Definition: EnhancedChangesList.php:596
ChangesList\isCategorizationWithoutRevision
isCategorizationWithoutRevision( $rcObj)
Determines whether a revision is linked to this change; this may not be the case when the categorizat...
Definition: ChangesList.php:737
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
ChangesList\recentChangesFlags
recentChangesFlags( $flags, $nothing='&#160;')
Returns the appropriate flags for new page, minor change and patrolling.
Definition: ChangesList.php:152
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
$link
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition: hooks.txt:2929
ChangesList
Definition: ChangesList.php:28
RC_CATEGORIZE
const RC_CATEGORIZE
Definition: Defines.php:144
Skin
The main skin class which provides methods and properties for all other skins.
Definition: Skin.php:34
RecentChange\getTitle
& getTitle()
Definition: RecentChange.php:252
Title\newFromID
static newFromID( $id, $flags=0)
Create a new Title from an article ID.
Definition: Title.php:405
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
Revision\DELETED_TEXT
const DELETED_TEXT
Definition: Revision.php:90
ChangesList\getHTMLClassesForFilters
getHTMLClassesForFilters( $rc)
Get an array of CSS classes attributed to filters for this row.
Definition: ChangesList.php:199
ChangesList\userCan
static userCan( $rc, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
Definition: ChangesList.php:598
array
the array() calling protocol came about after MediaWiki 1.4rc1.
EnhancedChangesList\addCacheEntry
addCacheEntry(RCCacheEntry $cacheEntry)
Put accumulated information into the cache, for later display.
Definition: EnhancedChangesList.php:130