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