MediaWiki  master
HistoryPager.php
Go to the documentation of this file.
1 <?php
30 
39  public $lastRow = false;
40  public $lastResultOffset = false;
41 
43 
44  protected $oldIdChecked;
45 
46  protected $preventClickjacking = false;
50  protected $parentLens;
51 
53  protected $showTagEditUI;
54 
56  private $tagFilter;
57 
59  private $revisionStore;
60 
63 
66 
69 
73  private $revisions = [];
74 
78  private $formattedComments = [];
79 
91  public function __construct(
93  $year = '',
94  $month = '',
95  $tagFilter = '',
96  array $conds = [],
97  $day = '',
101  ) {
102  parent::__construct( $historyPage->getContext() );
103  $this->historyPage = $historyPage;
104  $this->tagFilter = $tagFilter;
105  $this->getDateCond( $year, $month, $day );
106  $this->conds = $conds;
107  $this->showTagEditUI = ChangeTags::showTagEditingUI( $this->getAuthority() );
108  $services = MediaWikiServices::getInstance();
109  $this->revisionStore = $services->getRevisionStore();
110  $this->linkBatchFactory = $linkBatchFactory ?? $services->getLinkBatchFactory();
111  $this->watchlistManager = $watchlistManager
112  ?? $services->getWatchlistManager();
113  $this->commentFormatter = $commentFormatter ?? $services->getCommentFormatter();
114  }
115 
116  // For hook compatibility...
117  public function getArticle() {
118  return $this->historyPage->getArticle();
119  }
120 
121  protected function getSqlComment() {
122  if ( $this->conds ) {
123  return 'history page filtered'; // potentially slow, see CR r58153
124  } else {
125  return 'history page unfiltered';
126  }
127  }
128 
129  public function getQueryInfo() {
130  $revQuery = $this->revisionStore->getQueryInfo( [ 'user' ] );
131  // T270033 Index renaming
132  $revIndex = $this->mDb->indexExists( 'revision', 'page_timestamp', __METHOD__ )
133  ? 'page_timestamp'
134  : 'rev_page_timestamp';
135 
136  $queryInfo = [
137  'tables' => $revQuery['tables'],
138  'fields' => $revQuery['fields'],
139  'conds' => array_merge(
140  [ 'rev_page' => $this->getWikiPage()->getId() ],
141  $this->conds ),
142  'options' => [ 'USE INDEX' => [ 'revision' => $revIndex ] ],
143  'join_conds' => $revQuery['joins'],
144  ];
146  $queryInfo['tables'],
147  $queryInfo['fields'],
148  $queryInfo['conds'],
149  $queryInfo['join_conds'],
150  $queryInfo['options'],
151  $this->tagFilter
152  );
153 
154  $this->getHookRunner()->onPageHistoryPager__getQueryInfo( $this, $queryInfo );
155 
156  return $queryInfo;
157  }
158 
159  public function getIndexField() {
160  return [ [ 'rev_timestamp', 'rev_id' ] ];
161  }
162 
167  public function formatRow( $row ) {
168  if ( $this->lastRow ) {
169  $firstInList = $this->counter == 1;
170  $this->counter++;
171 
172  $notifTimestamp = $this->getConfig()->get( 'ShowUpdatedMarker' )
173  ? $this->watchlistManager
174  ->getTitleNotificationTimestamp( $this->getUser(), $this->getTitle() )
175  : false;
176 
177  $s = $this->historyLine( $this->lastRow, $row, $notifTimestamp,
178  $firstInList, $this->lastResultOffset );
179  } else {
180  $s = '';
181  }
182  $this->lastRow = $row;
183  $this->lastResultOffset = $this->getResultOffset();
184 
185  return $s;
186  }
187 
188  protected function doBatchLookups() {
189  if ( !$this->getHookRunner()->onPageHistoryPager__doBatchLookups( $this, $this->mResult ) ) {
190  return;
191  }
192 
193  # Do a link batch query
194  $batch = $this->linkBatchFactory->newLinkBatch();
195  $revIds = [];
196  $title = $this->getTitle();
197  foreach ( $this->mResult as $row ) {
198  if ( $row->rev_parent_id ) {
199  $revIds[] = (int)$row->rev_parent_id;
200  }
201  if ( $row->user_name !== null ) {
202  $batch->add( NS_USER, $row->user_name );
203  $batch->add( NS_USER_TALK, $row->user_name );
204  } else { # for anons or usernames of imported revisions
205  $batch->add( NS_USER, $row->rev_user_text );
206  $batch->add( NS_USER_TALK, $row->rev_user_text );
207  }
208  $this->revisions[] = $this->revisionStore->newRevisionFromRow(
209  $row,
210  RevisionStore::READ_NORMAL,
211  $title
212  );
213  }
214  $this->parentLens = $this->revisionStore->getRevisionSizes( $revIds );
215  $batch->execute();
216 
217  # The keys of $this->formattedComments will be the same as the keys of $this->revisions
218  $this->formattedComments = $this->commentFormatter->createRevisionBatch()
219  ->revisions( $this->revisions )
220  ->authority( $this->getAuthority() )
221  ->samePage( false )
222  ->hideIfDeleted( true )
223  ->useParentheses( false )
224  ->execute();
225 
226  $this->mResult->seek( 0 );
227  }
228 
233  protected function getEmptyBody() {
234  return $this->msg( 'history-empty' )->escaped();
235  }
236 
242  protected function getStartBody() {
243  $this->lastRow = false;
244  $this->counter = 1;
245  $this->oldIdChecked = 0;
246  $s = '';
247  // Button container stored in $this->buttons for re-use in getEndBody()
248  $this->buttons = '';
249  if ( $this->getNumRows() > 0 ) {
250  $this->getOutput()->wrapWikiMsg( "<div class='mw-history-legend'>\n$1\n</div>", 'histlegend' );
251  $s = Html::openElement( 'form', [
252  'action' => wfScript(),
253  'id' => 'mw-history-compare'
254  ] ) . "\n";
255  $s .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n";
256  $s .= Html::hidden( 'action', 'historysubmit' ) . "\n";
257  $s .= Html::hidden( 'type', 'revision' ) . "\n";
258 
259  $this->buttons .= Html::openElement(
260  'div', [ 'class' => 'mw-history-compareselectedversions' ] );
261  $className = 'historysubmit mw-history-compareselectedversions-button mw-ui-button';
262  $attrs = [ 'class' => $className ]
263  + Linker::tooltipAndAccesskeyAttribs( 'compareselectedversions' );
264  $this->buttons .= $this->submitButton( $this->msg( 'compareselectedversions' )->text(),
265  $attrs
266  ) . "\n";
267 
268  $actionButtons = '';
269  if ( $this->getAuthority()->isAllowed( 'deleterevision' ) ) {
270  $actionButtons .= $this->getRevisionButton(
271  'revisiondelete', 'showhideselectedversions' );
272  }
273  if ( $this->showTagEditUI ) {
274  $actionButtons .= $this->getRevisionButton(
275  'editchangetags', 'history-edit-tags' );
276  }
277  if ( $actionButtons ) {
278  $this->buttons .= Xml::tags( 'div', [ 'class' =>
279  'mw-history-revisionactions' ], $actionButtons );
280  }
281 
282  if ( $this->getAuthority()->isAllowed( 'deleterevision' ) || $this->showTagEditUI ) {
283  $this->buttons .= ( new ListToggle( $this->getOutput() ) )->getHTML();
284  }
285 
286  $this->buttons .= '</div>';
287 
288  $s .= $this->buttons;
289  $s .= '<ul id="pagehistory">' . "\n";
290  }
291 
292  return $s;
293  }
294 
295  private function getRevisionButton( $name, $msg ) {
296  $this->setPreventClickjacking( true );
297  $element = Html::element(
298  'button',
299  [
300  'type' => 'submit',
301  'name' => $name,
302  'value' => '1',
303  'class' => "historysubmit mw-history-$name-button mw-ui-button",
304  ],
305  $this->msg( $msg )->text()
306  ) . "\n";
307  return $element;
308  }
309 
310  protected function getEndBody() {
311  if ( $this->getNumRows() == 0 ) {
312  return '';
313  }
314 
315  if ( $this->lastRow ) {
316  $firstInList = $this->counter == 1;
317  if ( $this->mIsBackwards ) {
318  # Next row is unknown, but for UI reasons, probably exists if an offset has been specified
319  if ( $this->mOffset == '' ) {
320  $next = null;
321  } else {
322  $next = 'unknown';
323  }
324  } else {
325  # The next row is the past-the-end row
326  $next = $this->mPastTheEndRow;
327  }
328  $this->counter++;
329 
330  $notifTimestamp = $this->getConfig()->get( 'ShowUpdatedMarker' )
331  ? $this->watchlistManager
332  ->getTitleNotificationTimestamp( $this->getUser(), $this->getTitle() )
333  : false;
334 
335  $s = $this->historyLine( $this->lastRow, $next, $notifTimestamp,
336  $firstInList, $this->lastResultOffset );
337  } else {
338  $s = '';
339  }
340  $s .= "</ul>\n";
341  # Add second buttons only if there is more than one rev
342  if ( $this->getNumRows() > 2 ) {
343  $s .= $this->buttons;
344  }
345  $s .= '</form>';
346  return $s;
347  }
348 
356  private function submitButton( $message, $attributes = [] ) {
357  # Disable submit button if history has 1 revision only
358  if ( $this->getNumRows() > 1 ) {
359  return Html::submitButton( $message, $attributes );
360  } else {
361  return '';
362  }
363  }
364 
379  private function historyLine( $row, $next, $notificationtimestamp,
380  $firstInList, $resultOffset
381  ) {
382  $revRecord = $this->revisions[$resultOffset];
383 
384  if ( is_object( $next ) ) {
385  $previousRevRecord = $this->revisionStore->newRevisionFromRow(
386  $next,
387  RevisionStore::READ_NORMAL,
388  $this->getTitle()
389  );
390  } else {
391  $previousRevRecord = null;
392  }
393 
394  $latest = $revRecord->getId() === $this->getWikiPage()->getLatest();
395  $curlink = $this->curLink( $revRecord );
396  $lastlink = $this->lastLink( $revRecord, $next );
397  $curLastlinks = Html::rawElement( 'span', [], $curlink ) .
398  Html::rawElement( 'span', [], $lastlink );
399  $histLinks = Html::rawElement(
400  'span',
401  [ 'class' => 'mw-history-histlinks mw-changeslist-links' ],
402  $curLastlinks
403  );
404 
405  $diffButtons = $this->diffButtons( $revRecord, $firstInList );
406  $s = $histLinks . $diffButtons;
407 
408  $link = $this->revLink( $revRecord );
409  $classes = [];
410 
411  $del = '';
412  $user = $this->getUser();
413  $canRevDelete = $this->getAuthority()->isAllowed( 'deleterevision' );
414  // Show checkboxes for each revision, to allow for revision deletion and
415  // change tags
416  $visibility = $revRecord->getVisibility();
417  if ( $canRevDelete || $this->showTagEditUI ) {
418  $this->setPreventClickjacking( true );
419  // If revision was hidden from sysops and we don't need the checkbox
420  // for anything else, disable it
421  if ( !$this->showTagEditUI
422  && !$revRecord->userCan( RevisionRecord::DELETED_RESTRICTED, $this->getAuthority() )
423  ) {
424  $del = Xml::check( 'deleterevisions', false, [ 'disabled' => 'disabled' ] );
425  // Otherwise, enable the checkbox...
426  } else {
427  $del = Xml::check( 'showhiderevisions', false,
428  [ 'name' => 'ids[' . $revRecord->getId() . ']' ] );
429  }
430  // User can only view deleted revisions...
431  } elseif ( $revRecord->getVisibility() && $this->getAuthority()->isAllowed( 'deletedhistory' ) ) {
432  // If revision was hidden from sysops, disable the link
433  if ( !$revRecord->userCan( RevisionRecord::DELETED_RESTRICTED, $this->getAuthority() ) ) {
434  $del = Linker::revDeleteLinkDisabled( false );
435  // Otherwise, show the link...
436  } else {
437  $query = [
438  'type' => 'revision',
439  'target' => $this->getTitle()->getPrefixedDBkey(),
440  'ids' => $revRecord->getId()
441  ];
442  $del .= Linker::revDeleteLink(
443  $query,
444  $revRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED ),
445  false
446  );
447  }
448  }
449  if ( $del ) {
450  $s .= " $del ";
451  }
452 
453  $lang = $this->getLanguage();
454  $dirmark = $lang->getDirMark();
455 
456  $s .= " $link";
457  $s .= $dirmark;
458  $s .= " <span class='history-user'>" .
459  Linker::revUserTools( $revRecord, true, false ) . "</span>";
460  $s .= $dirmark;
461 
462  if ( $revRecord->isMinor() ) {
463  $s .= ' ' . ChangesList::flag( 'minor', $this->getContext() );
464  }
465 
466  # Sometimes rev_len isn't populated
467  if ( $revRecord->getSize() !== null ) {
468  # Size is always public data
469  $prevSize = $this->parentLens[$row->rev_parent_id] ?? 0;
470  $sDiff = ChangesList::showCharacterDifference( $prevSize, $revRecord->getSize() );
471  $fSize = Linker::formatRevisionSize( $revRecord->getSize() );
472  $s .= ' <span class="mw-changeslist-separator"></span> ' . "$fSize $sDiff";
473  }
474 
475  # Text following the character difference is added just before running hooks
476  $s2 = $this->formattedComments[$resultOffset];
477 
478  if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
479  $s2 .= ' <span class="updatedmarker">' . $this->msg( 'updatedmarker' )->escaped() . '</span>';
480  $classes[] = 'mw-history-line-updated';
481  }
482 
483  $tools = [];
484 
485  # Rollback and undo links
486 
487  if ( $previousRevRecord && $this->getAuthority()->probablyCan( 'edit', $this->getTitle() ) ) {
488  if ( $latest && $this->getAuthority()->probablyCan( 'rollback', $this->getTitle() )
489  ) {
490  // Get a rollback link without the brackets
491  $rollbackLink = Linker::generateRollback(
492  $revRecord,
493  $this->getContext(),
494  [ 'verify', 'noBrackets' ]
495  );
496  if ( $rollbackLink ) {
497  $this->setPreventClickjacking( true );
498  $tools[] = $rollbackLink;
499  }
500  }
501 
502  if ( !$revRecord->isDeleted( RevisionRecord::DELETED_TEXT )
503  && !$previousRevRecord->isDeleted( RevisionRecord::DELETED_TEXT )
504  ) {
505  # Create undo tooltip for the first (=latest) line only
506  $undoTooltip = $latest
507  ? [ 'title' => $this->msg( 'tooltip-undo' )->text() ]
508  : [];
509  $undolink = $this->getLinkRenderer()->makeKnownLink(
510  $this->getTitle(),
511  $this->msg( 'editundo' )->text(),
512  $undoTooltip,
513  [
514  'action' => 'edit',
515  'undoafter' => $previousRevRecord->getId(),
516  'undo' => $revRecord->getId()
517  ]
518  );
519  $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
520  }
521  }
522  // Allow extension to add their own links here
523  $this->getHookRunner()->onHistoryTools(
524  $revRecord,
525  $tools,
526  $previousRevRecord,
527  $user
528  );
529 
530  if ( $tools ) {
531  $s2 .= ' ' . Html::openElement( 'span', [ 'class' => 'mw-changeslist-links' ] );
532  foreach ( $tools as $tool ) {
533  $s2 .= Html::rawElement( 'span', [], $tool );
534  }
535  $s2 .= Html::closeElement( 'span' );
536  }
537 
538  # Tags
539  list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
540  $row->ts_tags,
541  'history',
542  $this->getContext()
543  );
544  $classes = array_merge( $classes, $newClasses );
545  if ( $tagSummary !== '' ) {
546  $s2 .= " $tagSummary";
547  }
548 
549  # Include separator between character difference and following text
550  if ( $s2 !== '' ) {
551  $s .= ' <span class="mw-changeslist-separator"></span> ' . $s2;
552  }
553 
554  $attribs = [ 'data-mw-revid' => $revRecord->getId() ];
555 
556  $this->getHookRunner()->onPageHistoryLineEnding( $this, $row, $s, $classes, $attribs );
557  $attribs = array_filter( $attribs,
558  [ Sanitizer::class, 'isReservedDataAttribute' ],
559  ARRAY_FILTER_USE_KEY
560  );
561 
562  if ( $classes ) {
563  $attribs['class'] = implode( ' ', $classes );
564  }
565 
566  return Xml::tags( 'li', $attribs, $s ) . "\n";
567  }
568 
575  private function revLink( RevisionRecord $rev ) {
576  return ChangesList::revDateLink( $rev, $this->getUser(), $this->getLanguage(),
577  $this->getTitle() );
578  }
579 
586  private function curLink( RevisionRecord $rev ) {
587  $cur = $this->historyPage->message['cur'];
588  $latest = $this->getWikiPage()->getLatest();
589  if ( $latest === $rev->getId()
590  || !$rev->userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() )
591  ) {
592  return $cur;
593  } else {
594  return $this->getLinkRenderer()->makeKnownLink(
595  $this->getTitle(),
596  new HtmlArmor( $cur ),
597  [],
598  [
599  'diff' => $latest,
600  'oldid' => $rev->getId()
601  ]
602  );
603  }
604  }
605 
615  private function lastLink( RevisionRecord $prevRev, $next ) {
616  $last = $this->historyPage->message['last'];
617 
618  if ( $next === null ) {
619  # Probably no next row
620  return $last;
621  }
622 
623  $linkRenderer = $this->getLinkRenderer();
624  if ( $next === 'unknown' ) {
625  # Next row probably exists but is unknown, use an oldid=prev link
626  return $linkRenderer->makeKnownLink(
627  $this->getTitle(),
628  new HtmlArmor( $last ),
629  [],
630  [
631  'diff' => $prevRev->getId(),
632  'oldid' => 'prev'
633  ]
634  );
635  }
636 
637  $nextRev = $this->revisionStore->newRevisionFromRow(
638  $next,
639  RevisionStore::READ_NORMAL,
640  $this->getTitle()
641  );
642 
643  if ( !$prevRev->userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() ) ||
644  !$nextRev->userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() )
645  ) {
646  return $last;
647  }
648 
649  return $linkRenderer->makeKnownLink(
650  $this->getTitle(),
651  new HtmlArmor( $last ),
652  [],
653  [
654  'diff' => $prevRev->getId(),
655  'oldid' => $next->rev_id
656  ]
657  );
658  }
659 
668  private function diffButtons( RevisionRecord $rev, $firstInList ) {
669  if ( $this->getNumRows() > 1 ) {
670  $id = $rev->getId();
671  $radio = [ 'type' => 'radio', 'value' => $id ];
673  if ( $firstInList ) {
674  $first = Xml::element( 'input',
675  array_merge( $radio, [
676  // Disable the hidden radio because it can still
677  // be selected with arrow keys on Firefox
678  'disabled' => '',
679  'name' => 'oldid',
680  'id' => 'mw-oldid-null' ] )
681  );
682  $checkmark = [ 'checked' => 'checked' ];
683  } else {
684  # Check visibility of old revisions
685  if ( !$rev->userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() ) ) {
686  $radio['disabled'] = 'disabled';
687  $checkmark = []; // We will check the next possible one
688  } elseif ( !$this->oldIdChecked ) {
689  $checkmark = [ 'checked' => 'checked' ];
690  $this->oldIdChecked = $id;
691  } else {
692  $checkmark = [];
693  }
694  $first = Xml::element( 'input',
695  array_merge( $radio, $checkmark, [
696  'name' => 'oldid',
697  'id' => "mw-oldid-$id" ] ) );
698  $checkmark = [];
699  }
700  $second = Xml::element( 'input',
701  array_merge( $radio, $checkmark, [
702  'name' => 'diff',
703  'id' => "mw-diff-$id" ] ) );
704 
705  return $first . $second;
706  } else {
707  return '';
708  }
709  }
710 
716  protected function isNavigationBarShown() {
717  if ( $this->getNumRows() == 0 ) {
718  return false;
719  }
720  return parent::isNavigationBarShown();
721  }
722 
726  public function getDefaultQuery() {
727  parent::getDefaultQuery();
728  unset( $this->mDefaultQuery['date-range-to'] );
729  return $this->mDefaultQuery;
730  }
731 
737  private function setPreventClickjacking( bool $flag ) {
738  $this->preventClickjacking = $flag;
739  }
740 
745  public function getPreventClickjacking() {
747  }
748 
749 }
ContextSource\getConfig
getConfig()
Definition: ContextSource.php:72
ReverseChronologicalPager\getDateCond
getDateCond( $year, $month, $day=-1)
Set and return the mOffset timestamp such that we can get all revisions with a timestamp up to the sp...
Definition: ReverseChronologicalPager.php:84
ContextSource\getContext
getContext()
Get the base IContextSource object.
Definition: ContextSource.php:47
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:30
MediaWiki\Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:47
HistoryPager\$counter
$counter
Definition: HistoryPager.php:42
HistoryPager\$parentLens
array $parentLens
Definition: HistoryPager.php:50
Linker\revUserTools
static revUserTools(RevisionRecord $revRecord, $isPublic=false, $useParentheses=true)
Generate a user tool link cluster if the current user is allowed to view it.
Definition: Linker.php:1319
HistoryPager\getPreventClickjacking
getPreventClickjacking()
Get the "prevent clickjacking" flag.
Definition: HistoryPager.php:745
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:199
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:37
HistoryPager\getArticle
getArticle()
Definition: HistoryPager.php:117
MediaWiki\Revision\RevisionStore
Service for looking up page revisions.
Definition: RevisionStore.php:88
HistoryPager\$commentFormatter
CommentFormatter $commentFormatter
Definition: HistoryPager.php:68
HistoryPager\$linkBatchFactory
LinkBatchFactory $linkBatchFactory
Definition: HistoryPager.php:65
HistoryPager\$showTagEditUI
bool $showTagEditUI
Whether to show the tag editing UI.
Definition: HistoryPager.php:53
HistoryPager\getEmptyBody
getEmptyBody()
Returns message when query returns no revisions.
Definition: HistoryPager.php:233
HistoryPager\$tagFilter
string $tagFilter
Definition: HistoryPager.php:56
HistoryPager\getDefaultQuery
getDefaultQuery()
@inheritDoc
Definition: HistoryPager.php:726
HistoryPager\getRevisionButton
getRevisionButton( $name, $msg)
Definition: HistoryPager.php:295
IndexPager\$linkRenderer
LinkRenderer $linkRenderer
Definition: IndexPager.php:167
HistoryPager\$conds
$conds
Definition: HistoryPager.php:42
ContextSource\getUser
getUser()
Definition: ContextSource.php:136
MediaWiki\CommentFormatter\CommentFormatter
This is the main service interface for converting single-line comments from various DB comment fields...
Definition: CommentFormatter.php:16
ContextSource\getTitle
getTitle()
Definition: ContextSource.php:90
$revQuery
$revQuery
Definition: testCompression.php:56
HistoryPager\historyLine
historyLine( $row, $next, $notificationtimestamp, $firstInList, $resultOffset)
Returns a row from the history printout.
Definition: HistoryPager.php:379
Linker\tooltipAndAccesskeyAttribs
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[], $options=null)
Returns the attributes for the tooltip and access key.
Definition: Linker.php:2181
IndexPager\$mPastTheEndRow
stdClass bool null $mPastTheEndRow
Extra row fetched at the end to see if the end was reached.
Definition: IndexPager.php:102
HistoryPager\submitButton
submitButton( $message, $attributes=[])
Creates a submit button.
Definition: HistoryPager.php:356
ContextSource\getLanguage
getLanguage()
Definition: ContextSource.php:153
HistoryPager\$historyPage
$historyPage
Definition: HistoryPager.php:42
HistoryPager\$lastRow
bool stdClass $lastRow
Definition: HistoryPager.php:39
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:316
ChangeTags\modifyDisplayQuery
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='')
Applies all tags-related changes to a query.
Definition: ChangeTags.php:891
MediaWiki\Watchlist\WatchlistManager
WatchlistManager service.
Definition: WatchlistManager.php:52
HistoryPager\doBatchLookups
doBatchLookups()
Called from getBody(), before getStartBody() is called and after doQuery() was called.
Definition: HistoryPager.php:188
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:2282
HistoryPager\$buttons
$buttons
Definition: HistoryPager.php:42
HistoryAction
This class handles printing the history page for an article.
Definition: HistoryAction.php:38
ListToggle
Class for generating clickable toggle links for a list of checkboxes.
Definition: ListToggle.php:31
ContextSource\getOutput
getOutput()
Definition: ContextSource.php:126
HistoryPager\getSqlComment
getSqlComment()
Get some text to go in brackets in the "function name" part of the SQL comment.
Definition: HistoryPager.php:121
MediaWiki\Cache\LinkBatchFactory
Definition: LinkBatchFactory.php:39
Xml\check
static check( $name, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox.
Definition: Xml.php:329
ContextSource\getWikiPage
getWikiPage()
Get the WikiPage object.
Definition: ContextSource.php:117
HistoryPager\$oldIdChecked
$oldIdChecked
Definition: HistoryPager.php:44
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
HistoryPager\$watchlistManager
WatchlistManager $watchlistManager
Definition: HistoryPager.php:62
HistoryPager\getIndexField
getIndexField()
Returns the name of the index field.
Definition: HistoryPager.php:159
ChangesList\flag
static flag( $flag, IContextSource $context=null)
Make an "<abbr>" element for a given change flag.
Definition: ChangesList.php:273
Linker\revDeleteLinkDisabled
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
Definition: Linker.php:2162
HistoryPager
Definition: HistoryPager.php:35
$title
$title
Definition: testCompression.php:38
HistoryPager\formatRow
formatRow( $row)
Definition: HistoryPager.php:167
Linker\generateRollback
static generateRollback(RevisionRecord $revRecord, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
Definition: Linker.php:1757
HistoryPager\revLink
revLink(RevisionRecord $rev)
Create a link to view this revision of the page.
Definition: HistoryPager.php:575
ContextSource\msg
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:197
Html\hidden
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:831
HistoryPager\$formattedComments
string[] $formattedComments
Formatted comments, with the key being their result offset as for $revisions.
Definition: HistoryPager.php:78
$s
foreach( $mmfl['setupFiles'] as $fileName) if( $queue) if(empty( $mmfl['quiet'])) $s
Definition: mergeMessageFileList.php:206
HistoryPager\getEndBody
getEndBody()
Hook into getBody() for the end of the list.
Definition: HistoryPager.php:310
ContextSource\getAuthority
getAuthority()
Definition: ContextSource.php:144
HistoryPager\$preventClickjacking
$preventClickjacking
Definition: HistoryPager.php:46
Xml\tags
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:132
HistoryPager\$revisionStore
RevisionStore $revisionStore
Definition: HistoryPager.php:59
Linker\formatRevisionSize
static formatRevisionSize( $size)
Definition: Linker.php:1546
ChangesList\showCharacterDifference
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
Definition: ChangesList.php:347
HistoryPager\$revisions
RevisionRecord[] $revisions
Revisions, with the key being their result offset.
Definition: HistoryPager.php:73
HistoryPager\getQueryInfo
getQueryInfo()
Provides all parameters needed for the main paged query.
Definition: HistoryPager.php:129
IndexPager\getLinkRenderer
getLinkRenderer()
Definition: IndexPager.php:991
NS_USER
const NS_USER
Definition: Defines.php:66
Html\submitButton
static submitButton( $contents, array $attrs, array $modifiers=[])
Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enab...
Definition: Html.php:186
ChangesList\revDateLink
static revDateLink(RevisionRecord $rev, Authority $performer, 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:439
HistoryPager\curLink
curLink(RevisionRecord $rev)
Create a diff-to-current link for this revision for this page.
Definition: HistoryPager.php:586
MediaWiki\Revision\RevisionRecord\getId
getId( $wikiId=self::LOCAL)
Get revision ID.
Definition: RevisionRecord.php:279
MediaWiki\Revision\RevisionRecord\userCan
userCan( $field, Authority $performer)
Determine if the give authority is allowed to view a particular field of this revision,...
Definition: RevisionRecord.php:509
HistoryPager\setPreventClickjacking
setPreventClickjacking(bool $flag)
Set the "prevent clickjacking" flag; for example if a write operation if possible from the generated ...
Definition: HistoryPager.php:737
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:252
Html\rawElement
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:210
Linker\revDeleteLink
static revDeleteLink( $query=[], $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
Definition: Linker.php:2138
NS_USER_TALK
const NS_USER_TALK
Definition: Defines.php:67
ReverseChronologicalPager
Efficient paging for SQL queries.
Definition: ReverseChronologicalPager.php:29
HistoryPager\diffButtons
diffButtons(RevisionRecord $rev, $firstInList)
Create radio buttons for page history.
Definition: HistoryPager.php:668
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:232
HistoryPager\getStartBody
getStartBody()
Creates begin of history list with a submit button.
Definition: HistoryPager.php:242
HistoryPager\isNavigationBarShown
isNavigationBarShown()
Returns whether to show the "navigation bar".
Definition: HistoryPager.php:716
ChangeTags\showTagEditingUI
static showTagEditingUI(Authority $performer)
Indicate whether change tag editing UI is relevant.
Definition: ChangeTags.php:1738
HistoryPager\__construct
__construct(HistoryAction $historyPage, $year='', $month='', $tagFilter='', array $conds=[], $day='', LinkBatchFactory $linkBatchFactory=null, WatchlistManager $watchlistManager=null, CommentFormatter $commentFormatter=null)
Definition: HistoryPager.php:91
HistoryPager\lastLink
lastLink(RevisionRecord $prevRev, $next)
Create a diff-to-previous link for this revision for this page.
Definition: HistoryPager.php:615
ChangeTags\formatSummaryRow
static formatSummaryRow( $tags, $page, IContextSource $context=null)
Creates HTML for the given tags.
Definition: ChangeTags.php:194
IndexPager\$mDefaultQuery
array $mDefaultQuery
Definition: IndexPager.php:149
HistoryPager\$lastResultOffset
$lastResultOffset
Definition: HistoryPager.php:40
IndexPager\getNumRows
getNumRows()
Get the number of rows in the result set.
Definition: IndexPager.php:742
IndexPager\getResultOffset
getResultOffset()
Definition: IndexPager.php:314