(bug 19859) Remove HTMLDiff. Could possibly be salvaged as an extension one day,...
[lhc/web/wiklou.git] / includes / HistoryPage.php
1 <?php
2 /**
3 * Page history
4 *
5 * Split off from Article.php and Skin.php, 2003-12-22
6 * @file
7 */
8
9 /**
10 * This class handles printing the history page for an article. In order to
11 * be efficient, it uses timestamps rather than offsets for paging, to avoid
12 * costly LIMIT,offset queries.
13 *
14 * Construct it by passing in an Article, and call $h->history() to print the
15 * history.
16 *
17 */
18 class HistoryPage {
19 const DIR_PREV = 0;
20 const DIR_NEXT = 1;
21
22 var $article, $title, $skin;
23
24 /**
25 * Construct a new HistoryPage.
26 *
27 * @param Article $article
28 * @returns nothing
29 */
30 function __construct( $article ) {
31 global $wgUser;
32 $this->article = $article;
33 $this->title = $article->getTitle();
34 $this->skin = $wgUser->getSkin();
35 $this->preCacheMessages();
36 }
37
38 function getArticle() {
39 return $this->article;
40 }
41
42 function getTitle() {
43 return $this->title;
44 }
45
46 /**
47 * As we use the same small set of messages in various methods and that
48 * they are called often, we call them once and save them in $this->message
49 */
50 function preCacheMessages() {
51 // Precache various messages
52 if( !isset( $this->message ) ) {
53 $msgs = array( 'cur', 'last', 'rev-delundel', 'pipe-separator' );
54 foreach( $msgs as $msg ) {
55 $this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities') );
56 }
57 }
58 }
59
60 /**
61 * Print the history page for an article.
62 *
63 * @returns nothing
64 */
65 function history() {
66 global $wgOut, $wgRequest, $wgScript;
67
68 /*
69 * Allow client caching.
70 */
71 if( $wgOut->checkLastModified( $this->article->getTouched() ) )
72 return; // Client cache fresh and headers sent, nothing more to do.
73
74 wfProfileIn( __METHOD__ );
75
76 /*
77 * Setup page variables.
78 */
79 $wgOut->setPageTitle( wfMsg( 'history-title', $this->title->getPrefixedText() ) );
80 $wgOut->setPageTitleActionText( wfMsg( 'history_short' ) );
81 $wgOut->setArticleFlag( false );
82 $wgOut->setArticleRelated( true );
83 $wgOut->setRobotPolicy( 'noindex,nofollow' );
84 $wgOut->setSyndicated( true );
85 $wgOut->setFeedAppendQuery( 'action=history' );
86 $wgOut->addScriptFile( 'history.js' );
87
88 $logPage = SpecialPage::getTitleFor( 'Log' );
89 $logLink = $this->skin->link(
90 $logPage,
91 wfMsgHtml( 'viewpagelogs' ),
92 array(),
93 array( 'page' => $this->title->getPrefixedText() ),
94 array( 'known', 'noclasses' )
95 );
96 $wgOut->setSubtitle( $logLink );
97
98 $feedType = $wgRequest->getVal( 'feed' );
99 if( $feedType ) {
100 wfProfileOut( __METHOD__ );
101 return $this->feed( $feedType );
102 }
103
104 /*
105 * Fail if article doesn't exist.
106 */
107 if( !$this->title->exists() ) {
108 $wgOut->addWikiMsg( 'nohistory' );
109 # show deletion/move log if there is an entry
110 LogEventsList::showLogExtract(
111 $wgOut,
112 array( 'delete', 'move' ),
113 $this->title->getPrefixedText(),
114 '',
115 array( 'lim' => 10,
116 'conds' => array( "log_action != 'revision'" ),
117 'showIfEmpty' => false,
118 'msgKey' => array( 'moveddeleted-notice' )
119 )
120 );
121 wfProfileOut( __METHOD__ );
122 return;
123 }
124
125 /**
126 * Add date selector to quickly get to a certain time
127 */
128 $year = $wgRequest->getInt( 'year' );
129 $month = $wgRequest->getInt( 'month' );
130 $tagFilter = $wgRequest->getVal( 'tagfilter' );
131 $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter );
132 /**
133 * Option to show only revisions that have been (partially) hidden via RevisionDelete
134 * Note that this can run a *long* time if there are many revisions to look at.
135 * We use "isBigDeletion" to determine if the history is too big to go through.
136 * Additionally, only users with 'deleterevision' right can filter for deleted edits.
137 */
138 if ( $this->title->userCan( 'deleterevision' ) && ( !$this->article->isBigDeletion() || $this->title->userCan( 'bigdelete' ) ) ) {
139 $conds = ( $wgRequest->getBool( 'deleted' ) ) ? array("rev_deleted != '0'") : array();
140 $checkDeleted = Xml::checkLabel( wfMsg( 'history-show-deleted' ), 'deleted', '', $wgRequest->getBool( 'deleted' ) ) . "\n";
141 }
142 else { # Don't filter and don't add the checkbox for filtering
143 $conds = array();
144 $checkDeleted = '';
145 }
146
147 $action = htmlspecialchars( $wgScript );
148 $wgOut->addHTML(
149 "<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" .
150 Xml::fieldset(
151 wfMsg( 'history-fieldset-title' ),
152 false,
153 array( 'id' => 'mw-history-search' )
154 ) .
155 Xml::hidden( 'title', $this->title->getPrefixedDBKey() ) . "\n" .
156 Xml::hidden( 'action', 'history' ) . "\n" .
157 Xml::dateMenu( $year, $month ) . '&nbsp;' .
158 ( $tagSelector ? ( implode( '&nbsp;', $tagSelector ) . '&nbsp;' ) : '' ) .
159 $checkDeleted .
160 Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
161 '</fieldset></form>'
162 );
163
164 wfRunHooks( 'PageHistoryBeforeList', array( &$this->article ) );
165
166 /**
167 * Do the list
168 */
169 $pager = new HistoryPager( $this, $year, $month, $tagFilter, $conds );
170 $wgOut->addHTML(
171 $pager->getNavigationBar() .
172 $pager->getBody() .
173 $pager->getNavigationBar()
174 );
175
176 wfProfileOut( __METHOD__ );
177 }
178
179 /**
180 * Fetch an array of revisions, specified by a given limit, offset and
181 * direction. This is now only used by the feeds. It was previously
182 * used by the main UI but that's now handled by the pager.
183 */
184 function fetchRevisions($limit, $offset, $direction) {
185 $dbr = wfGetDB( DB_SLAVE );
186
187 if( $direction == HistoryPage::DIR_PREV )
188 list($dirs, $oper) = array("ASC", ">=");
189 else /* $direction == HistoryPage::DIR_NEXT */
190 list($dirs, $oper) = array("DESC", "<=");
191
192 if( $offset )
193 $offsets = array("rev_timestamp $oper '$offset'");
194 else
195 $offsets = array();
196
197 $page_id = $this->title->getArticleID();
198
199 return $dbr->select( 'revision',
200 Revision::selectFields(),
201 array_merge(array("rev_page=$page_id"), $offsets),
202 __METHOD__,
203 array( 'ORDER BY' => "rev_timestamp $dirs",
204 'USE INDEX' => 'page_timestamp', 'LIMIT' => $limit)
205 );
206 }
207
208 /**
209 * Output a subscription feed listing recent edits to this page.
210 * @param string $type
211 */
212 function feed( $type ) {
213 global $wgFeedClasses, $wgRequest, $wgFeedLimit;
214 if( !FeedUtils::checkFeedOutput($type) ) {
215 return;
216 }
217
218 $feed = new $wgFeedClasses[$type](
219 $this->title->getPrefixedText() . ' - ' .
220 wfMsgForContent( 'history-feed-title' ),
221 wfMsgForContent( 'history-feed-description' ),
222 $this->title->getFullUrl( 'action=history' )
223 );
224
225 // Get a limit on number of feed entries. Provide a sane default
226 // of 10 if none is defined (but limit to $wgFeedLimit max)
227 $limit = $wgRequest->getInt( 'limit', 10 );
228 if( $limit > $wgFeedLimit || $limit < 1 ) {
229 $limit = 10;
230 }
231 $items = $this->fetchRevisions($limit, 0, HistoryPage::DIR_NEXT);
232
233 $feed->outHeader();
234 if( $items ) {
235 foreach( $items as $row ) {
236 $feed->outItem( $this->feedItem( $row ) );
237 }
238 } else {
239 $feed->outItem( $this->feedEmpty() );
240 }
241 $feed->outFooter();
242 }
243
244 function feedEmpty() {
245 global $wgOut;
246 return new FeedItem(
247 wfMsgForContent( 'nohistory' ),
248 $wgOut->parse( wfMsgForContent( 'history-feed-empty' ) ),
249 $this->title->getFullUrl(),
250 wfTimestamp( TS_MW ),
251 '',
252 $this->title->getTalkPage()->getFullUrl()
253 );
254 }
255
256 /**
257 * Generate a FeedItem object from a given revision table row
258 * Borrows Recent Changes' feed generation functions for formatting;
259 * includes a diff to the previous revision (if any).
260 *
261 * @param $row
262 * @return FeedItem
263 */
264 function feedItem( $row ) {
265 $rev = new Revision( $row );
266 $rev->setTitle( $this->title );
267 $text = FeedUtils::formatDiffRow(
268 $this->title,
269 $this->title->getPreviousRevisionID( $rev->getId() ),
270 $rev->getId(),
271 $rev->getTimestamp(),
272 $rev->getComment()
273 );
274 if( $rev->getComment() == '' ) {
275 global $wgContLang;
276 $title = wfMsgForContent( 'history-feed-item-nocomment',
277 $rev->getUserText(),
278 $wgContLang->timeanddate( $rev->getTimestamp() ),
279 $wgContLang->date( $rev->getTimestamp() ),
280 $wgContLang->time( $rev->getTimestamp() )
281 );
282 } else {
283 $title = $rev->getUserText() .
284 wfMsgForContent( 'colon-separator' ) .
285 FeedItem::stripComment( $rev->getComment() );
286 }
287 return new FeedItem(
288 $title,
289 $text,
290 $this->title->getFullUrl( 'diff=' . $rev->getId() . '&oldid=prev' ),
291 $rev->getTimestamp(),
292 $rev->getUserText(),
293 $this->title->getTalkPage()->getFullUrl()
294 );
295 }
296 }
297
298 /**
299 * @ingroup Pager
300 */
301 class HistoryPager extends ReverseChronologicalPager {
302 public $lastRow = false, $counter, $historyPage, $title, $buttons, $conds;
303 protected $oldIdChecked;
304
305 function __construct( $historyPage, $year='', $month='', $tagFilter = '', $conds = array() ) {
306 parent::__construct();
307 $this->historyPage = $historyPage;
308 $this->title = $this->historyPage->title;
309 $this->tagFilter = $tagFilter;
310 $this->getDateCond( $year, $month );
311 $this->conds = $conds;
312 }
313
314 // For hook compatibility...
315 function getArticle() {
316 return $this->historyPage->getArticle();
317 }
318
319 function getQueryInfo() {
320 $queryInfo = array(
321 'tables' => array('revision'),
322 'fields' => array_merge( Revision::selectFields()),
323 'conds' => array_merge( array('rev_page' => $this->historyPage->title->getArticleID() ), $this->conds ),
324 'options' => array( 'USE INDEX' => array('revision' => 'page_timestamp') ),
325 'join_conds' => array( 'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ),
326 );
327 ChangeTags::modifyDisplayQuery(
328 $queryInfo['tables'],
329 $queryInfo['fields'],
330 $queryInfo['conds'],
331 $queryInfo['join_conds'],
332 $queryInfo['options'],
333 $this->tagFilter
334 );
335 wfRunHooks( 'PageHistoryPager::getQueryInfo', array( &$this, &$queryInfo ) );
336 return $queryInfo;
337 }
338
339 function getIndexField() {
340 return 'rev_timestamp';
341 }
342
343 function formatRow( $row ) {
344 if( $this->lastRow ) {
345 $latest = ($this->counter == 1 && $this->mIsFirst);
346 $firstInList = $this->counter == 1;
347 $s = $this->historyLine( $this->lastRow, $row, $this->counter++,
348 $this->title->getNotificationTimestamp(), $latest, $firstInList );
349 } else {
350 $s = '';
351 }
352 $this->lastRow = $row;
353 return $s;
354 }
355
356 /**
357 * Creates begin of history list with a submit button
358 *
359 * @return string HTML output
360 */
361 function getStartBody() {
362 global $wgScript, $wgUser, $wgOut, $wgContLang;
363 $this->lastRow = false;
364 $this->counter = 1;
365 $this->oldIdChecked = 0;
366
367 $wgOut->wrapWikiMsg( "<div class='mw-history-legend'>\n$1</div>", 'histlegend' );
368 $s = Xml::openElement( 'form', array( 'action' => $wgScript,
369 'id' => 'mw-history-compare' ) ) . "\n";
370 $s .= Xml::hidden( 'title', $this->title->getPrefixedDbKey() ) . "\n";
371 $s .= Xml::hidden( 'action', 'historysubmit' ) . "\n";
372
373 $this->buttons = '<div>';
374 if( $wgUser->isAllowed('deleterevision') ) {
375 $float = $wgContLang->alignEnd();
376 # Note bug #20966, <button> is non-standard in IE<8
377 $this->buttons .= Xml::element( 'button',
378 array(
379 'type' => 'submit',
380 'name' => 'revisiondelete',
381 'value' => '1',
382 'style' => "float: $float;",
383 'class' => 'mw-history-revisiondelete-button',
384 ),
385 wfMsg( 'showhideselectedversions' )
386 ) . "\n";
387 }
388 $this->buttons .= $this->submitButton( wfMsg( 'compareselectedversions'),
389 array(
390 'class' => 'historysubmit',
391 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
392 'title' => wfMsg( 'tooltip-compareselectedversions' ),
393 )
394 ) . "\n";
395 $this->buttons .= '</div>';
396 $s .= $this->buttons . '<ul id="pagehistory">' . "\n";
397 return $s;
398 }
399
400 function getEndBody() {
401 if( $this->lastRow ) {
402 $latest = $this->counter == 1 && $this->mIsFirst;
403 $firstInList = $this->counter == 1;
404 if( $this->mIsBackwards ) {
405 # Next row is unknown, but for UI reasons, probably exists if an offset has been specified
406 if( $this->mOffset == '' ) {
407 $next = null;
408 } else {
409 $next = 'unknown';
410 }
411 } else {
412 # The next row is the past-the-end row
413 $next = $this->mPastTheEndRow;
414 }
415 $s = $this->historyLine( $this->lastRow, $next, $this->counter++,
416 $this->title->getNotificationTimestamp(), $latest, $firstInList );
417 } else {
418 $s = '';
419 }
420 $s .= "</ul>\n";
421 $s .= $this->buttons;
422 $s .= '</form>';
423 return $s;
424 }
425
426 /**
427 * Creates a submit button
428 *
429 * @param array $attributes attributes
430 * @return string HTML output for the submit button
431 */
432 function submitButton($message, $attributes = array() ) {
433 # Disable submit button if history has 1 revision only
434 if( $this->getNumRows() > 1 ) {
435 return Xml::submitButton( $message , $attributes );
436 } else {
437 return '';
438 }
439 }
440
441 /**
442 * Returns a row from the history printout.
443 *
444 * @todo document some more, and maybe clean up the code (some params redundant?)
445 *
446 * @param Row $row The database row corresponding to the previous line.
447 * @param mixed $next The database row corresponding to the next line.
448 * @param int $counter Apparently a counter of what row number we're at, counted from the top row = 1.
449 * @param $notificationtimestamp
450 * @param bool $latest Whether this row corresponds to the page's latest revision.
451 * @param bool $firstInList Whether this row corresponds to the first displayed on this history page.
452 * @return string HTML output for the row
453 */
454 function historyLine( $row, $next, $counter = '', $notificationtimestamp = false,
455 $latest = false, $firstInList = false )
456 {
457 global $wgUser, $wgLang;
458 $rev = new Revision( $row );
459 $rev->setTitle( $this->title );
460
461 $curlink = $this->curLink( $rev, $latest );
462 $lastlink = $this->lastLink( $rev, $next, $counter );
463 $diffButtons = $this->diffButtons( $rev, $firstInList, $counter );
464 $histLinks = Html::rawElement(
465 'span',
466 array( 'class' => 'mw-history-histlinks' ),
467 '(' . $curlink . $this->historyPage->message['pipe-separator'] . $lastlink . ') '
468 );
469 $s = $histLinks . $diffButtons;
470
471 $link = $this->revLink( $rev );
472 $classes = array();
473
474 $del = '';
475 if( $wgUser->isAllowed( 'deleterevision' ) ) {
476 // If revision was hidden from sysops, disable the checkbox
477 if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
478 $del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) );
479 // Otherwise, enable the checkbox...
480 } else {
481 $del = Xml::check( 'showhiderevisions', false, array( 'name' => 'ids['.$rev->getId().']' ) );
482 }
483 // User can only view deleted revisions...
484 } else if( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) {
485 // If revision was hidden from sysops, disable the link
486 if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
487 $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ),
488 '(' . $this->historyPage->message['rev-delundel'] . ')' );
489 // Otherwise, show the link...
490 } else {
491 $query = array( 'type' => 'revision',
492 'target' => $this->title->getPrefixedDbkey(), 'ids' => $rev->getId() );
493 $del .= $this->getSkin()->revDeleteLink( $query, $rev->isDeleted( Revision::DELETED_RESTRICTED ) );
494 }
495 }
496 if( $del ) $s .= " $del ";
497
498 $s .= " $link";
499 $s .= " <span class='history-user'>" . $this->getSkin()->revUserTools( $rev, true ) . "</span>";
500
501 if( $rev->isMinor() ) {
502 $s .= ' ' . ChangesList::flag( 'minor' );
503 }
504
505 if( !is_null( $size = $rev->getSize() ) && !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
506 $s .= ' ' . $this->getSkin()->formatRevisionSize( $size );
507 }
508
509 $s .= $this->getSkin()->revComment( $rev, false, true );
510
511 if( $notificationtimestamp && ($row->rev_timestamp >= $notificationtimestamp) ) {
512 $s .= ' <span class="updatedmarker">' . wfMsgHtml( 'updatedmarker' ) . '</span>';
513 }
514
515 $tools = array();
516
517 # Rollback and undo links
518 if( !is_null( $next ) && is_object( $next ) ) {
519 if( $latest && $this->title->userCan( 'rollback' ) && $this->title->userCan( 'edit' ) ) {
520 $tools[] = '<span class="mw-rollback-link">'.
521 $this->getSkin()->buildRollbackLink( $rev ).'</span>';
522 }
523
524 if( $this->title->quickUserCan( 'edit' )
525 && !$rev->isDeleted( Revision::DELETED_TEXT )
526 && !$next->rev_deleted & Revision::DELETED_TEXT )
527 {
528 # Create undo tooltip for the first (=latest) line only
529 $undoTooltip = $latest
530 ? array( 'title' => wfMsg( 'tooltip-undo' ) )
531 : array();
532 $undolink = $this->getSkin()->link(
533 $this->title,
534 wfMsgHtml( 'editundo' ),
535 $undoTooltip,
536 array(
537 'action' => 'edit',
538 'undoafter' => $next->rev_id,
539 'undo' => $rev->getId()
540 ),
541 array( 'known', 'noclasses' )
542 );
543 $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
544 }
545 }
546
547 if( $tools ) {
548 $s .= ' (' . $wgLang->pipeList( $tools ) . ')';
549 }
550
551 # Tags
552 list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'history' );
553 $classes = array_merge( $classes, $newClasses );
554 $s .= " $tagSummary";
555
556 wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row , &$s ) );
557
558 $attribs = array();
559 if ( $classes ) {
560 $attribs['class'] = implode( ' ', $classes );
561 }
562
563 return Xml::tags( 'li', $attribs, $s ) . "\n";
564 }
565
566 /**
567 * Create a link to view this revision of the page
568 * @param Revision $rev
569 * @returns string
570 */
571 function revLink( $rev ) {
572 global $wgLang;
573 $date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
574 $date = htmlspecialchars( $date );
575 if( !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
576 $link = $this->getSkin()->link(
577 $this->title,
578 $date,
579 array(),
580 array( 'oldid' => $rev->getId() ),
581 array( 'known', 'noclasses' )
582 );
583 } else {
584 $link = "<span class=\"history-deleted\">$date</span>";
585 }
586 return $link;
587 }
588
589 /**
590 * Create a diff-to-current link for this revision for this page
591 * @param Revision $rev
592 * @param Bool $latest, this is the latest revision of the page?
593 * @returns string
594 */
595 function curLink( $rev, $latest ) {
596 $cur = $this->historyPage->message['cur'];
597 if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
598 return $cur;
599 } else {
600 return $this->getSkin()->link(
601 $this->title,
602 $cur,
603 array(),
604 array(
605 'diff' => $this->title->getLatestRevID(),
606 'oldid' => $rev->getId()
607 ),
608 array( 'known', 'noclasses' )
609 );
610 }
611 }
612
613 /**
614 * Create a diff-to-previous link for this revision for this page.
615 * @param Revision $prevRev, the previous revision
616 * @param mixed $next, the newer revision
617 * @param int $counter, what row on the history list this is
618 * @returns string
619 */
620 function lastLink( $prevRev, $next, $counter ) {
621 $last = $this->historyPage->message['last'];
622 # $next may either be a Row, null, or "unkown"
623 $nextRev = is_object($next) ? new Revision( $next ) : $next;
624 if( is_null($next) ) {
625 # Probably no next row
626 return $last;
627 } elseif( $next === 'unknown' ) {
628 # Next row probably exists but is unknown, use an oldid=prev link
629 return $this->getSkin()->link(
630 $this->title,
631 $last,
632 array(),
633 array(
634 'diff' => $prevRev->getId(),
635 'oldid' => 'prev'
636 ),
637 array( 'known', 'noclasses' )
638 );
639 } elseif( !$prevRev->userCan(Revision::DELETED_TEXT) || !$nextRev->userCan(Revision::DELETED_TEXT) ) {
640 return $last;
641 } else {
642 return $this->getSkin()->link(
643 $this->title,
644 $last,
645 array(),
646 array(
647 'diff' => $prevRev->getId(),
648 'oldid' => $next->rev_id
649 ),
650 array( 'known', 'noclasses' )
651 );
652 }
653 }
654
655 /**
656 * Create radio buttons for page history
657 *
658 * @param object $rev Revision
659 * @param bool $firstInList Is this version the first one?
660 * @param int $counter A counter of what row number we're at, counted from the top row = 1.
661 * @return string HTML output for the radio buttons
662 */
663 function diffButtons( $rev, $firstInList, $counter ) {
664 if( $this->getNumRows() > 1 ) {
665 $id = $rev->getId();
666 $radio = array( 'type' => 'radio', 'value' => $id );
667 /** @todo: move title texts to javascript */
668 if( $firstInList ) {
669 $first = Xml::element( 'input',
670 array_merge( $radio, array(
671 'style' => 'visibility:hidden',
672 'name' => 'oldid',
673 'id' => 'mw-oldid-null' ) )
674 );
675 $checkmark = array( 'checked' => 'checked' );
676 } else {
677 # Check visibility of old revisions
678 if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
679 $radio['disabled'] = 'disabled';
680 $checkmark = array(); // We will check the next possible one
681 } else if( $counter == 2 || !$this->oldIdChecked ) {
682 $checkmark = array( 'checked' => 'checked' );
683 $this->oldIdChecked = $id;
684 } else {
685 $checkmark = array();
686 }
687 $first = Xml::element( 'input',
688 array_merge( $radio, $checkmark, array(
689 'name' => 'oldid',
690 'id' => "mw-oldid-$id" ) ) );
691 $checkmark = array();
692 }
693 $second = Xml::element( 'input',
694 array_merge( $radio, $checkmark, array(
695 'name' => 'diff',
696 'id' => "mw-diff-$id" ) ) );
697 return $first . $second;
698 } else {
699 return '';
700 }
701 }
702 }
703
704 /**
705 * Backwards-compatibility aliases
706 */
707 class PageHistory extends HistoryPage {}
708 class PageHistoryPager extends HistoryPager {}