MediaWiki  master
HistoryPager.php
Go to the documentation of this file.
1 <?php
29 
38  public $lastRow = false;
39 
41 
42  protected $oldIdChecked;
43 
44  protected $preventClickjacking = false;
48  protected $parentLens;
49 
51  protected $showTagEditUI;
52 
54  private $tagFilter;
55 
57  private $revisionStore;
58 
61 
64 
75  public function __construct(
77  $year = '',
78  $month = '',
79  $tagFilter = '',
80  array $conds = [],
81  $day = '',
84  ) {
85  parent::__construct( $historyPage->getContext() );
86  $this->historyPage = $historyPage;
87  $this->tagFilter = $tagFilter;
88  $this->getDateCond( $year, $month, $day );
89  $this->conds = $conds;
90  $this->showTagEditUI = ChangeTags::showTagEditingUI( $this->getUser() );
91  $services = MediaWikiServices::getInstance();
92  $this->revisionStore = $services->getRevisionStore();
93  $this->linkBatchFactory = $linkBatchFactory ?? $services->getLinkBatchFactory();
94  $this->watchlistNotificationManager = $watchlistNotificationManager
95  ?? $services->getWatchlistNotificationManager();
96  }
97 
98  // For hook compatibility...
99  public function getArticle() {
100  return $this->historyPage->getArticle();
101  }
102 
103  protected function getSqlComment() {
104  if ( $this->conds ) {
105  return 'history page filtered'; // potentially slow, see CR r58153
106  } else {
107  return 'history page unfiltered';
108  }
109  }
110 
111  public function getQueryInfo() {
112  $revQuery = $this->revisionStore->getQueryInfo( [ 'user' ] );
113  $queryInfo = [
114  'tables' => $revQuery['tables'],
115  'fields' => $revQuery['fields'],
116  'conds' => array_merge(
117  [ 'rev_page' => $this->getWikiPage()->getId() ],
118  $this->conds ),
119  'options' => [ 'USE INDEX' => [ 'revision' => 'page_timestamp' ] ],
120  'join_conds' => $revQuery['joins'],
121  ];
123  $queryInfo['tables'],
124  $queryInfo['fields'],
125  $queryInfo['conds'],
126  $queryInfo['join_conds'],
127  $queryInfo['options'],
128  $this->tagFilter
129  );
130 
131  $this->getHookRunner()->onPageHistoryPager__getQueryInfo( $this, $queryInfo );
132 
133  return $queryInfo;
134  }
135 
136  public function getIndexField() {
137  return [ [ 'rev_timestamp', 'rev_id' ] ];
138  }
139 
144  public function formatRow( $row ) {
145  if ( $this->lastRow ) {
146  $firstInList = $this->counter == 1;
147  $this->counter++;
148 
149  $notifTimestamp = $this->getConfig()->get( 'ShowUpdatedMarker' )
150  ? $this->watchlistNotificationManager
151  ->getTitleNotificationTimestamp( $this->getUser(), $this->getTitle() )
152  : false;
153 
154  $s = $this->historyLine( $this->lastRow, $row, $notifTimestamp, false, $firstInList );
155  } else {
156  $s = '';
157  }
158  $this->lastRow = $row;
159 
160  return $s;
161  }
162 
163  protected function doBatchLookups() {
164  if ( !$this->getHookRunner()->onPageHistoryPager__doBatchLookups( $this, $this->mResult ) ) {
165  return;
166  }
167 
168  # Do a link batch query
169  $this->mResult->seek( 0 );
170  $batch = $this->linkBatchFactory->newLinkBatch();
171  $revIds = [];
172  foreach ( $this->mResult as $row ) {
173  if ( $row->rev_parent_id ) {
174  $revIds[] = $row->rev_parent_id;
175  }
176  if ( $row->user_name !== null ) {
177  $batch->add( NS_USER, $row->user_name );
178  $batch->add( NS_USER_TALK, $row->user_name );
179  } else { # for anons or usernames of imported revisions
180  $batch->add( NS_USER, $row->rev_user_text );
181  $batch->add( NS_USER_TALK, $row->rev_user_text );
182  }
183  }
184  $this->parentLens = $this->revisionStore->getRevisionSizes( $revIds );
185  $batch->execute();
186  $this->mResult->seek( 0 );
187  }
188 
193  protected function getEmptyBody() {
194  return $this->msg( 'history-empty' )->escaped();
195  }
196 
202  protected function getStartBody() {
203  $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
204  $this->lastRow = false;
205  $this->counter = 1;
206  $this->oldIdChecked = 0;
207  $s = '';
208  // Button container stored in $this->buttons for re-use in getEndBody()
209  $this->buttons = '';
210  if ( $this->getNumRows() > 0 ) {
211  $this->getOutput()->wrapWikiMsg( "<div class='mw-history-legend'>\n$1\n</div>", 'histlegend' );
212  $s = Html::openElement( 'form', [
213  'action' => wfScript(),
214  'id' => 'mw-history-compare'
215  ] ) . "\n";
216  $s .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n";
217  $s .= Html::hidden( 'action', 'historysubmit' ) . "\n";
218  $s .= Html::hidden( 'type', 'revision' ) . "\n";
219 
220  $this->buttons .= Html::openElement(
221  'div', [ 'class' => 'mw-history-compareselectedversions' ] );
222  $className = 'historysubmit mw-history-compareselectedversions-button mw-ui-button';
223  $attrs = [ 'class' => $className ]
224  + Linker::tooltipAndAccesskeyAttribs( 'compareselectedversions' );
225  $this->buttons .= $this->submitButton( $this->msg( 'compareselectedversions' )->text(),
226  $attrs
227  ) . "\n";
228 
229  $user = $this->getUser();
230  $actionButtons = '';
231  if ( $permissionManager->userHasRight( $user, 'deleterevision' ) ) {
232  $actionButtons .= $this->getRevisionButton(
233  'revisiondelete', 'showhideselectedversions' );
234  }
235  if ( $this->showTagEditUI ) {
236  $actionButtons .= $this->getRevisionButton(
237  'editchangetags', 'history-edit-tags' );
238  }
239  if ( $actionButtons ) {
240  $this->buttons .= Xml::tags( 'div', [ 'class' =>
241  'mw-history-revisionactions' ], $actionButtons );
242  }
243 
244  if ( $permissionManager->userHasRight( $user, 'deleterevision' ) || $this->showTagEditUI ) {
245  $this->buttons .= ( new ListToggle( $this->getOutput() ) )->getHTML();
246  }
247 
248  $this->buttons .= '</div>';
249 
250  $s .= $this->buttons;
251  $s .= '<ul id="pagehistory">' . "\n";
252  }
253 
254  return $s;
255  }
256 
257  private function getRevisionButton( $name, $msg ) {
258  $this->preventClickjacking();
259  $element = Html::element(
260  'button',
261  [
262  'type' => 'submit',
263  'name' => $name,
264  'value' => '1',
265  'class' => "historysubmit mw-history-$name-button mw-ui-button",
266  ],
267  $this->msg( $msg )->text()
268  ) . "\n";
269  return $element;
270  }
271 
272  protected function getEndBody() {
273  if ( $this->getNumRows() == 0 ) {
274  return '';
275  }
276 
277  if ( $this->lastRow ) {
278  $firstInList = $this->counter == 1;
279  if ( $this->mIsBackwards ) {
280  # Next row is unknown, but for UI reasons, probably exists if an offset has been specified
281  if ( $this->mOffset == '' ) {
282  $next = null;
283  } else {
284  $next = 'unknown';
285  }
286  } else {
287  # The next row is the past-the-end row
288  $next = $this->mPastTheEndRow;
289  }
290  $this->counter++;
291 
292  $notifTimestamp = $this->getConfig()->get( 'ShowUpdatedMarker' )
293  ? $this->watchlistNotificationManager
294  ->getTitleNotificationTimestamp( $this->getUser(), $this->getTitle() )
295  : false;
296 
297  $s = $this->historyLine( $this->lastRow, $next, $notifTimestamp, false, $firstInList );
298  } else {
299  $s = '';
300  }
301  $s .= "</ul>\n";
302  # Add second buttons only if there is more than one rev
303  if ( $this->getNumRows() > 2 ) {
304  $s .= $this->buttons;
305  }
306  $s .= '</form>';
307  return $s;
308  }
309 
317  private function submitButton( $message, $attributes = [] ) {
318  # Disable submit button if history has 1 revision only
319  if ( $this->getNumRows() > 1 ) {
320  return Html::submitButton( $message, $attributes );
321  } else {
322  return '';
323  }
324  }
325 
340  private function historyLine( $row, $next, $notificationtimestamp = false,
341  $dummy = false, $firstInList = false ) {
342  $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
343 
344  $revRecord = $this->revisionStore->newRevisionFromRow(
345  $row,
346  RevisionStore::READ_NORMAL,
347  $this->getTitle()
348  );
349 
350  if ( is_object( $next ) ) {
351  $previousRevRecord = $this->revisionStore->newRevisionFromRow(
352  $next,
353  RevisionStore::READ_NORMAL,
354  $this->getTitle()
355  );
356  } else {
357  $previousRevRecord = null;
358  }
359 
360  $latest = $revRecord->getId() === $this->getWikiPage()->getLatest();
361  $curlink = $this->curLink( $revRecord );
362  $lastlink = $this->lastLink( $revRecord, $next );
363  $curLastlinks = Html::rawElement( 'span', [], $curlink ) .
364  Html::rawElement( 'span', [], $lastlink );
365  $histLinks = Html::rawElement(
366  'span',
367  [ 'class' => 'mw-history-histlinks mw-changeslist-links' ],
368  $curLastlinks
369  );
370 
371  $diffButtons = $this->diffButtons( $revRecord, $firstInList );
372  $s = $histLinks . $diffButtons;
373 
374  $link = $this->revLink( $revRecord );
375  $classes = [];
376 
377  $del = '';
378  $user = $this->getUser();
379  $canRevDelete = $permissionManager->userHasRight( $user, 'deleterevision' );
380  // Show checkboxes for each revision, to allow for revision deletion and
381  // change tags
382  $visibility = $revRecord->getVisibility();
383  if ( $canRevDelete || $this->showTagEditUI ) {
384  $this->preventClickjacking();
385  // If revision was hidden from sysops and we don't need the checkbox
386  // for anything else, disable it
387  if ( !$this->showTagEditUI
388  && !RevisionRecord::userCanBitfield(
389  $visibility,
390  RevisionRecord::DELETED_RESTRICTED,
391  $user
392  )
393  ) {
394  $del = Xml::check( 'deleterevisions', false, [ 'disabled' => 'disabled' ] );
395  // Otherwise, enable the checkbox...
396  } else {
397  $del = Xml::check( 'showhiderevisions', false,
398  [ 'name' => 'ids[' . $revRecord->getId() . ']' ] );
399  }
400  // User can only view deleted revisions...
401  } elseif ( $visibility && $permissionManager->userHasRight( $user, 'deletedhistory' ) ) {
402  // If revision was hidden from sysops, disable the link
403  if ( !RevisionRecord::userCanBitfield(
404  $visibility,
405  RevisionRecord::DELETED_RESTRICTED,
406  $user
407  ) ) {
408  $del = Linker::revDeleteLinkDisabled( false );
409  // Otherwise, show the link...
410  } else {
411  $query = [
412  'type' => 'revision',
413  'target' => $this->getTitle()->getPrefixedDBkey(),
414  'ids' => $revRecord->getId()
415  ];
416  $del .= Linker::revDeleteLink(
417  $query,
418  $revRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED ),
419  false
420  );
421  }
422  }
423  if ( $del ) {
424  $s .= " $del ";
425  }
426 
427  $lang = $this->getLanguage();
428  $dirmark = $lang->getDirMark();
429 
430  $s .= " $link";
431  $s .= $dirmark;
432  $s .= " <span class='history-user'>" .
433  Linker::revUserTools( $revRecord, true, false ) . "</span>";
434  $s .= $dirmark;
435 
436  if ( $revRecord->isMinor() ) {
437  $s .= ' ' . ChangesList::flag( 'minor', $this->getContext() );
438  }
439 
440  # Sometimes rev_len isn't populated
441  if ( $revRecord->getSize() !== null ) {
442  # Size is always public data
443  $prevSize = $this->parentLens[$row->rev_parent_id] ?? 0;
444  $sDiff = ChangesList::showCharacterDifference( $prevSize, $revRecord->getSize() );
445  $fSize = Linker::formatRevisionSize( $revRecord->getSize() );
446  $s .= ' <span class="mw-changeslist-separator"></span> ' . "$fSize $sDiff";
447  }
448 
449  # Text following the character difference is added just before running hooks
450  $s2 = Linker::revComment( $revRecord, false, true, false );
451 
452  if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
453  $s2 .= ' <span class="updatedmarker">' . $this->msg( 'updatedmarker' )->escaped() . '</span>';
454  $classes[] = 'mw-history-line-updated';
455  }
456 
457  $tools = [];
458 
459  # Rollback and undo links
460 
461  if ( $previousRevRecord &&
462  $permissionManager->quickUserCan( 'edit', $user, $this->getTitle() )
463  ) {
464  if ( $latest && $permissionManager->quickUserCan( 'rollback',
465  $user, $this->getTitle() )
466  ) {
467  // Get a rollback link without the brackets
468  $rollbackLink = Linker::generateRollback(
469  $revRecord,
470  $this->getContext(),
471  [ 'verify', 'noBrackets' ]
472  );
473  if ( $rollbackLink ) {
474  $this->preventClickjacking();
475  $tools[] = $rollbackLink;
476  }
477  }
478 
479  if ( !$revRecord->isDeleted( RevisionRecord::DELETED_TEXT )
480  && !$previousRevRecord->isDeleted( RevisionRecord::DELETED_TEXT )
481  ) {
482  # Create undo tooltip for the first (=latest) line only
483  $undoTooltip = $latest
484  ? [ 'title' => $this->msg( 'tooltip-undo' )->text() ]
485  : [];
486  $undolink = $this->getLinkRenderer()->makeKnownLink(
487  $this->getTitle(),
488  $this->msg( 'editundo' )->text(),
489  $undoTooltip,
490  [
491  'action' => 'edit',
492  'undoafter' => $previousRevRecord->getId(),
493  'undo' => $revRecord->getId()
494  ]
495  );
496  $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
497  }
498  }
499  // Allow extension to add their own links here
500  $this->getHookRunner()->onHistoryTools(
501  $revRecord,
502  $tools,
503  $previousRevRecord,
504  $user
505  );
506 
507  // Hook is deprecated since 1.35
508  if ( $this->getHookContainer()->isRegistered( 'HistoryRevisionTools' ) ) {
509  // Only create the Revision objects if needed
510  $this->getHookRunner()->onHistoryRevisionTools(
511  new Revision( $revRecord ),
512  $tools,
513  $previousRevRecord ? new Revision( $previousRevRecord ) : null,
514  $user
515  );
516  }
517 
518  if ( $tools ) {
519  $s2 .= ' ' . Html::openElement( 'span', [ 'class' => 'mw-changeslist-links' ] );
520  foreach ( $tools as $tool ) {
521  $s2 .= Html::rawElement( 'span', [], $tool );
522  }
523  $s2 .= Html::closeElement( 'span' );
524  }
525 
526  # Tags
527  list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
528  $row->ts_tags,
529  'history',
530  $this->getContext()
531  );
532  $classes = array_merge( $classes, $newClasses );
533  if ( $tagSummary !== '' ) {
534  $s2 .= " $tagSummary";
535  }
536 
537  # Include separator between character difference and following text
538  if ( $s2 !== '' ) {
539  $s .= ' <span class="mw-changeslist-separator"></span> ' . $s2;
540  }
541 
542  $attribs = [ 'data-mw-revid' => $revRecord->getId() ];
543 
544  $this->getHookRunner()->onPageHistoryLineEnding( $this, $row, $s, $classes, $attribs );
545  $attribs = array_filter( $attribs,
546  [ Sanitizer::class, 'isReservedDataAttribute' ],
547  ARRAY_FILTER_USE_KEY
548  );
549 
550  if ( $classes ) {
551  $attribs['class'] = implode( ' ', $classes );
552  }
553 
554  return Xml::tags( 'li', $attribs, $s ) . "\n";
555  }
556 
563  private function revLink( RevisionRecord $rev ) {
564  return ChangesList::revDateLink( $rev, $this->getUser(), $this->getLanguage(),
565  $this->getTitle() );
566  }
567 
574  private function curLink( RevisionRecord $rev ) {
575  $cur = $this->historyPage->message['cur'];
576  $latest = $this->getWikiPage()->getLatest();
577  if ( $latest === $rev->getId()
578  || !RevisionRecord::userCanBitfield(
579  $rev->getVisibility(),
580  RevisionRecord::DELETED_TEXT,
581  $this->getUser()
582  )
583  ) {
584  return $cur;
585  } else {
586  return $this->getLinkRenderer()->makeKnownLink(
587  $this->getTitle(),
588  new HtmlArmor( $cur ),
589  [],
590  [
591  'diff' => $latest,
592  'oldid' => $rev->getId()
593  ]
594  );
595  }
596  }
597 
607  private function lastLink( RevisionRecord $prevRev, $next ) {
608  $last = $this->historyPage->message['last'];
609 
610  if ( $next === null ) {
611  # Probably no next row
612  return $last;
613  }
614 
615  $linkRenderer = $this->getLinkRenderer();
616  if ( $next === 'unknown' ) {
617  # Next row probably exists but is unknown, use an oldid=prev link
618  return $linkRenderer->makeKnownLink(
619  $this->getTitle(),
620  new HtmlArmor( $last ),
621  [],
622  [
623  'diff' => $prevRev->getId(),
624  'oldid' => 'prev'
625  ]
626  );
627  }
628 
629  $nextRev = $this->revisionStore->newRevisionFromRow(
630  $next,
631  RevisionStore::READ_NORMAL,
632  $this->getTitle()
633  );
634 
635  if ( !RevisionRecord::userCanBitfield(
636  $prevRev->getVisibility(),
637  RevisionRecord::DELETED_TEXT,
638  $this->getUser()
639  ) || !RevisionRecord::userCanBitfield(
640  $nextRev->getVisibility(),
641  RevisionRecord::DELETED_TEXT,
642  $this->getUser()
643  )
644  ) {
645  return $last;
646  }
647 
648  return $linkRenderer->makeKnownLink(
649  $this->getTitle(),
650  new HtmlArmor( $last ),
651  [],
652  [
653  'diff' => $prevRev->getId(),
654  'oldid' => $next->rev_id
655  ]
656  );
657  }
658 
667  private function diffButtons( RevisionRecord $rev, $firstInList ) {
668  if ( $this->getNumRows() > 1 ) {
669  $id = $rev->getId();
670  $radio = [ 'type' => 'radio', 'value' => $id ];
672  if ( $firstInList ) {
673  $first = Xml::element( 'input',
674  array_merge( $radio, [
675  'style' => 'visibility:hidden',
676  'name' => 'oldid',
677  'id' => 'mw-oldid-null' ] )
678  );
679  $checkmark = [ 'checked' => 'checked' ];
680  } else {
681  # Check visibility of old revisions
682  if ( !RevisionRecord::userCanBitfield(
683  $rev->getVisibility(),
684  RevisionRecord::DELETED_TEXT,
685  $this->getUser()
686  ) ) {
687  $radio['disabled'] = 'disabled';
688  $checkmark = []; // We will check the next possible one
689  } elseif ( !$this->oldIdChecked ) {
690  $checkmark = [ 'checked' => 'checked' ];
691  $this->oldIdChecked = $id;
692  } else {
693  $checkmark = [];
694  }
695  $first = Xml::element( 'input',
696  array_merge( $radio, $checkmark, [
697  'name' => 'oldid',
698  'id' => "mw-oldid-$id" ] ) );
699  $checkmark = [];
700  }
701  $second = Xml::element( 'input',
702  array_merge( $radio, $checkmark, [
703  'name' => 'diff',
704  'id' => "mw-diff-$id" ] ) );
705 
706  return $first . $second;
707  } else {
708  return '';
709  }
710  }
711 
715  public function getDefaultQuery() {
716  parent::getDefaultQuery();
717  unset( $this->mDefaultQuery['date-range-to'] );
718  return $this->mDefaultQuery;
719  }
720 
725  private function preventClickjacking( $enable = true ) {
726  $this->preventClickjacking = $enable;
727  }
728 
733  public function getPreventClickjacking() {
735  }
736 
737 }
ContextSource\getConfig
getConfig()
Definition: ContextSource.php:70
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:45
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:30
Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:46
HistoryPager\$counter
$counter
Definition: HistoryPager.php:40
HistoryPager\$parentLens
array $parentLens
Definition: HistoryPager.php:48
HistoryPager\historyLine
historyLine( $row, $next, $notificationtimestamp=false, $dummy=false, $firstInList=false)
Returns a row from the history printout.
Definition: HistoryPager.php:340
HistoryPager\getPreventClickjacking
getPreventClickjacking()
Get the "prevent clickjacking" flag.
Definition: HistoryPager.php:733
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:165
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:37
HistoryPager\getArticle
getArticle()
Definition: HistoryPager.php:99
Revision\RevisionStore
Service for looking up page revisions.
Definition: RevisionStore.php:80
HistoryPager\$linkBatchFactory
LinkBatchFactory $linkBatchFactory
Definition: HistoryPager.php:63
HistoryPager\$showTagEditUI
bool $showTagEditUI
Whether to show the tag editing UI.
Definition: HistoryPager.php:51
Linker\revComment
static revComment( $rev, $local=false, $isPublic=false, $useParentheses=true)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
Definition: Linker.php:1605
HistoryPager\getEmptyBody
getEmptyBody()
Returns message when query returns no revisions.
Definition: HistoryPager.php:193
HistoryPager\$tagFilter
string $tagFilter
Definition: HistoryPager.php:54
HistoryPager\getDefaultQuery
getDefaultQuery()
@inheritDoc
Definition: HistoryPager.php:715
HistoryPager\getRevisionButton
getRevisionButton( $name, $msg)
Definition: HistoryPager.php:257
$s
$s
Definition: mergeMessageFileList.php:184
IndexPager\$linkRenderer
LinkRenderer $linkRenderer
Definition: IndexPager.php:167
HistoryPager\__construct
__construct(HistoryAction $historyPage, $year='', $month='', $tagFilter='', array $conds=[], $day='', LinkBatchFactory $linkBatchFactory=null, WatchlistNotificationManager $watchlistNotificationManager=null)
Definition: HistoryPager.php:75
ChangeTags\showTagEditingUI
static showTagEditingUI(User $user)
Indicate whether change tag editing UI is relevant.
Definition: ChangeTags.php:1682
HistoryPager\$conds
$conds
Definition: HistoryPager.php:40
ContextSource\getUser
getUser()
Stable to override.
Definition: ContextSource.php:134
ContextSource\getTitle
getTitle()
Definition: ContextSource.php:88
$revQuery
$revQuery
Definition: testCompression.php:56
HistoryPager\$watchlistNotificationManager
WatchlistNotificationManager $watchlistNotificationManager
Definition: HistoryPager.php:60
Linker\tooltipAndAccesskeyAttribs
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[], $options=null)
Returns the attributes for the tooltip and access key.
Definition: Linker.php:2294
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:317
ContextSource\getLanguage
getLanguage()
Definition: ContextSource.php:143
HistoryPager\$historyPage
$historyPage
Definition: HistoryPager.php:40
Revision
Definition: Revision.php:40
HistoryPager\$lastRow
bool stdClass $lastRow
Definition: HistoryPager.php:38
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:318
ChangeTags\modifyDisplayQuery
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='')
Applies all tags-related changes to a query.
Definition: ChangeTags.php:851
HistoryPager\preventClickjacking
preventClickjacking( $enable=true)
This is called if a write operation is possible from the generated HTML.
Definition: HistoryPager.php:725
Linker\generateRollback
static generateRollback( $rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
Definition: Linker.php:1861
HistoryPager\doBatchLookups
doBatchLookups()
Called from getBody(), before getStartBody() is called and after doQuery() was called.
Definition: HistoryPager.php:163
wfScript
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Definition: GlobalFunctions.php:2518
MediaWiki\User\WatchlistNotificationManager
WatchlistNotificationManager service.
Definition: WatchlistNotificationManager.php:40
HistoryPager\$buttons
$buttons
Definition: HistoryPager.php:40
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:124
HistoryPager\getSqlComment
getSqlComment()
Get some text to go in brackets in the "function name" part of the SQL comment.
Definition: HistoryPager.php:103
MediaWiki\Cache\LinkBatchFactory
Definition: LinkBatchFactory.php:38
Xml\check
static check( $name, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox.
Definition: Xml.php:327
ContextSource\getWikiPage
getWikiPage()
Get the WikiPage object.
Definition: ContextSource.php:115
HistoryPager\$oldIdChecked
$oldIdChecked
Definition: HistoryPager.php:42
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\getIndexField
getIndexField()
Returns the name of the index field.
Definition: HistoryPager.php:136
ChangesList\flag
static flag( $flag, IContextSource $context=null)
Make an "<abbr>" element for a given change flag.
Definition: ChangesList.php:269
Linker\revDeleteLinkDisabled
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
Definition: Linker.php:2275
HistoryPager
Definition: HistoryPager.php:34
Linker\revUserTools
static revUserTools( $rev, $isPublic=false, $useParentheses=true)
Generate a user tool link cluster if the current user is allowed to view it.
Definition: Linker.php:1142
HistoryPager\formatRow
formatRow( $row)
Definition: HistoryPager.php:144
Revision\RevisionRecord\getId
getId()
Get revision ID.
Definition: RevisionRecord.php:271
HistoryPager\revLink
revLink(RevisionRecord $rev)
Create a link to view this revision of the page.
Definition: HistoryPager.php:563
ContextSource\msg
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:187
Html\hidden
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:805
NS_USER_TALK
const NS_USER_TALK
Definition: Defines.php:72
HistoryPager\getEndBody
getEndBody()
Hook into getBody() for the end of the list.
Definition: HistoryPager.php:272
HistoryPager\$preventClickjacking
$preventClickjacking
Definition: HistoryPager.php:44
Xml\tags
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:130
HistoryPager\$revisionStore
RevisionStore $revisionStore
Definition: HistoryPager.php:57
Linker\formatRevisionSize
static formatRevisionSize( $size)
Definition: Linker.php:1650
ChangesList\showCharacterDifference
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
Definition: ChangesList.php:333
HistoryPager\getQueryInfo
getQueryInfo()
Provides all parameters needed for the main paged query.
Definition: HistoryPager.php:111
IndexPager\getLinkRenderer
getLinkRenderer()
Definition: IndexPager.php:976
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:188
Revision\RevisionRecord\getVisibility
getVisibility()
Get the deletion bitfield of the revision.
Definition: RevisionRecord.php:423
HistoryPager\curLink
curLink(RevisionRecord $rev)
Create a diff-to-current link for this revision for this page.
Definition: HistoryPager.php:574
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:254
Html\rawElement
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:212
Linker\revDeleteLink
static revDeleteLink( $query=[], $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
Definition: Linker.php:2253
NS_USER
const NS_USER
Definition: Defines.php:71
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:667
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:234
ChangesList\revDateLink
static revDateLink(RevisionRecord $rev, User $user, Language $lang, $title=null)
Render the date and time of a revision in the current user language based on whether the user is able...
Definition: ChangesList.php:425
HistoryPager\getStartBody
getStartBody()
Creates begin of history list with a submit button.
Definition: HistoryPager.php:202
HistoryPager\lastLink
lastLink(RevisionRecord $prevRev, $next)
Create a diff-to-previous link for this revision for this page.
Definition: HistoryPager.php:607
ChangeTags\formatSummaryRow
static formatSummaryRow( $tags, $page, IContextSource $context=null)
Creates HTML for the given tags.
Definition: ChangeTags.php:174
IndexPager\$mDefaultQuery
array $mDefaultQuery
Definition: IndexPager.php:149
IndexPager\getNumRows
getNumRows()
Get the number of rows in the result set.
Definition: IndexPager.php:731