Revert r59730 for now. Has some warnings and might be causing a weird regression...
[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', '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 # Add second buttons only if there is more than one rev
422 if( $this->getNumRows() > 2 ) {
423 $s .= $this->buttons;
424 }
425 $s .= '</form>';
426 return $s;
427 }
428
429 /**
430 * Creates a submit button
431 *
432 * @param array $attributes attributes
433 * @return string HTML output for the submit button
434 */
435 function submitButton($message, $attributes = array() ) {
436 # Disable submit button if history has 1 revision only
437 if( $this->getNumRows() > 1 ) {
438 return Xml::submitButton( $message , $attributes );
439 } else {
440 return '';
441 }
442 }
443
444 /**
445 * Returns a row from the history printout.
446 *
447 * @todo document some more, and maybe clean up the code (some params redundant?)
448 *
449 * @param Row $row The database row corresponding to the previous line.
450 * @param mixed $next The database row corresponding to the next line.
451 * @param int $counter Apparently a counter of what row number we're at, counted from the top row = 1.
452 * @param $notificationtimestamp
453 * @param bool $latest Whether this row corresponds to the page's latest revision.
454 * @param bool $firstInList Whether this row corresponds to the first displayed on this history page.
455 * @return string HTML output for the row
456 */
457 function historyLine( $row, $next, $counter = '', $notificationtimestamp = false,
458 $latest = false, $firstInList = false )
459 {
460 global $wgUser, $wgLang;
461 $rev = new Revision( $row );
462 $rev->setTitle( $this->title );
463
464 $curlink = $this->curLink( $rev, $latest );
465 $lastlink = $this->lastLink( $rev, $next, $counter );
466 $diffButtons = $this->diffButtons( $rev, $firstInList, $counter );
467 $histLinks = Html::rawElement(
468 'span',
469 array( 'class' => 'mw-history-histlinks' ),
470 '(' . $curlink . $this->historyPage->message['pipe-separator'] . $lastlink . ') '
471 );
472 $s = $histLinks . $diffButtons;
473
474 $link = $this->revLink( $rev );
475 $classes = array();
476
477 $del = '';
478 // User can delete revisions...
479 if( $wgUser->isAllowed( 'deleterevision' ) ) {
480 // If revision was hidden from sysops, disable the checkbox
481 if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
482 $del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) );
483 // Otherwise, enable the checkbox...
484 } else {
485 $del = Xml::check( 'showhiderevisions', false, array( 'name' => 'ids['.$rev->getId().']' ) );
486 }
487 // User can only view deleted revisions...
488 } else if( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) {
489 // If revision was hidden from sysops, disable the link
490 if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
491 $cdel = $this->getSkin()->revDeleteLinkDisabled( false );
492 // Otherwise, show the link...
493 } else {
494 $query = array( 'type' => 'revision',
495 'target' => $this->title->getPrefixedDbkey(), 'ids' => $rev->getId() );
496 $del .= $this->getSkin()->revDeleteLink( $query,
497 $rev->isDeleted( Revision::DELETED_RESTRICTED ), false );
498 }
499 }
500 if( $del ) $s .= " $del ";
501
502 $s .= " $link";
503 $s .= " <span class='history-user'>" . $this->getSkin()->revUserTools( $rev, true ) . "</span>";
504
505 if( $rev->isMinor() ) {
506 $s .= ' ' . ChangesList::flag( 'minor' );
507 }
508
509 if( !is_null( $size = $rev->getSize() ) && !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
510 $s .= ' ' . $this->getSkin()->formatRevisionSize( $size );
511 }
512
513 $s .= $this->getSkin()->revComment( $rev, false, true );
514
515 if( $notificationtimestamp && ($row->rev_timestamp >= $notificationtimestamp) ) {
516 $s .= ' <span class="updatedmarker">' . wfMsgHtml( 'updatedmarker' ) . '</span>';
517 }
518
519 $tools = array();
520
521 # Rollback and undo links
522 if( !is_null( $next ) && is_object( $next ) ) {
523 if( $latest && $this->title->userCan( 'rollback' ) && $this->title->userCan( 'edit' ) ) {
524 $tools[] = '<span class="mw-rollback-link">'.
525 $this->getSkin()->buildRollbackLink( $rev ).'</span>';
526 }
527
528 if( $this->title->quickUserCan( 'edit' )
529 && !$rev->isDeleted( Revision::DELETED_TEXT )
530 && !$next->rev_deleted & Revision::DELETED_TEXT )
531 {
532 # Create undo tooltip for the first (=latest) line only
533 $undoTooltip = $latest
534 ? array( 'title' => wfMsg( 'tooltip-undo' ) )
535 : array();
536 $undolink = $this->getSkin()->link(
537 $this->title,
538 wfMsgHtml( 'editundo' ),
539 $undoTooltip,
540 array(
541 'action' => 'edit',
542 'undoafter' => $next->rev_id,
543 'undo' => $rev->getId()
544 ),
545 array( 'known', 'noclasses' )
546 );
547 $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
548 }
549 }
550
551 if( $tools ) {
552 $s .= ' (' . $wgLang->pipeList( $tools ) . ')';
553 }
554
555 # Tags
556 list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'history' );
557 $classes = array_merge( $classes, $newClasses );
558 $s .= " $tagSummary";
559
560 wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row , &$s ) );
561
562 $attribs = array();
563 if ( $classes ) {
564 $attribs['class'] = implode( ' ', $classes );
565 }
566
567 return Xml::tags( 'li', $attribs, $s ) . "\n";
568 }
569
570 /**
571 * Create a link to view this revision of the page
572 * @param Revision $rev
573 * @returns string
574 */
575 function revLink( $rev ) {
576 global $wgLang;
577 $date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
578 $date = htmlspecialchars( $date );
579 if( !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
580 $link = $this->getSkin()->link(
581 $this->title,
582 $date,
583 array(),
584 array( 'oldid' => $rev->getId() ),
585 array( 'known', 'noclasses' )
586 );
587 } else {
588 $link = "<span class=\"history-deleted\">$date</span>";
589 }
590 return $link;
591 }
592
593 /**
594 * Create a diff-to-current link for this revision for this page
595 * @param Revision $rev
596 * @param Bool $latest, this is the latest revision of the page?
597 * @returns string
598 */
599 function curLink( $rev, $latest ) {
600 $cur = $this->historyPage->message['cur'];
601 if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
602 return $cur;
603 } else {
604 return $this->getSkin()->link(
605 $this->title,
606 $cur,
607 array(),
608 array(
609 'diff' => $this->title->getLatestRevID(),
610 'oldid' => $rev->getId()
611 ),
612 array( 'known', 'noclasses' )
613 );
614 }
615 }
616
617 /**
618 * Create a diff-to-previous link for this revision for this page.
619 * @param Revision $prevRev, the previous revision
620 * @param mixed $next, the newer revision
621 * @param int $counter, what row on the history list this is
622 * @returns string
623 */
624 function lastLink( $prevRev, $next, $counter ) {
625 $last = $this->historyPage->message['last'];
626 # $next may either be a Row, null, or "unkown"
627 $nextRev = is_object($next) ? new Revision( $next ) : $next;
628 if( is_null($next) ) {
629 # Probably no next row
630 return $last;
631 } elseif( $next === 'unknown' ) {
632 # Next row probably exists but is unknown, use an oldid=prev link
633 return $this->getSkin()->link(
634 $this->title,
635 $last,
636 array(),
637 array(
638 'diff' => $prevRev->getId(),
639 'oldid' => 'prev'
640 ),
641 array( 'known', 'noclasses' )
642 );
643 } elseif( !$prevRev->userCan(Revision::DELETED_TEXT) || !$nextRev->userCan(Revision::DELETED_TEXT) ) {
644 return $last;
645 } else {
646 return $this->getSkin()->link(
647 $this->title,
648 $last,
649 array(),
650 array(
651 'diff' => $prevRev->getId(),
652 'oldid' => $next->rev_id
653 ),
654 array( 'known', 'noclasses' )
655 );
656 }
657 }
658
659 /**
660 * Create radio buttons for page history
661 *
662 * @param object $rev Revision
663 * @param bool $firstInList Is this version the first one?
664 * @param int $counter A counter of what row number we're at, counted from the top row = 1.
665 * @return string HTML output for the radio buttons
666 */
667 function diffButtons( $rev, $firstInList, $counter ) {
668 if( $this->getNumRows() > 1 ) {
669 $id = $rev->getId();
670 $radio = array( 'type' => 'radio', 'value' => $id );
671 /** @todo: move title texts to javascript */
672 if( $firstInList ) {
673 $first = Xml::element( 'input',
674 array_merge( $radio, array(
675 'style' => 'visibility:hidden',
676 'name' => 'oldid',
677 'id' => 'mw-oldid-null' ) )
678 );
679 $checkmark = array( 'checked' => 'checked' );
680 } else {
681 # Check visibility of old revisions
682 if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
683 $radio['disabled'] = 'disabled';
684 $checkmark = array(); // We will check the next possible one
685 } else if( $counter == 2 || !$this->oldIdChecked ) {
686 $checkmark = array( 'checked' => 'checked' );
687 $this->oldIdChecked = $id;
688 } else {
689 $checkmark = array();
690 }
691 $first = Xml::element( 'input',
692 array_merge( $radio, $checkmark, array(
693 'name' => 'oldid',
694 'id' => "mw-oldid-$id" ) ) );
695 $checkmark = array();
696 }
697 $second = Xml::element( 'input',
698 array_merge( $radio, $checkmark, array(
699 'name' => 'diff',
700 'id' => "mw-diff-$id" ) ) );
701 return $first . $second;
702 } else {
703 return '';
704 }
705 }
706 }
707
708 /**
709 * Backwards-compatibility aliases
710 */
711 class PageHistory extends HistoryPage {}
712 class PageHistoryPager extends HistoryPager {}