* Allow client caching.
*/
- if( $wgOut->checkLastModified( $this->mArticle->getTimestamp() ) )
+ if( $wgOut->checkLastModified( $this->mArticle->getTouched() ) )
/* Client cache fresh and headers sent, nothing more to do. */
return;
- $fname = 'PageHistory::history';
- wfProfileIn( $fname );
+ wfProfileIn( __METHOD__ );
/*
* Setup page variables.
$feedType = $wgRequest->getVal( 'feed' );
if( $feedType ) {
- wfProfileOut( $fname );
+ wfProfileOut( __METHOD__ );
return $this->feed( $feedType );
}
*/
if( !$this->mTitle->exists() ) {
$wgOut->addWikiMsg( 'nohistory' );
- wfProfileOut( $fname );
+ wfProfileOut( __METHOD__ );
return;
}
$this->endHistoryList() .
$pager->getNavigationBar()
);
- wfProfileOut( $fname );
+ wfProfileOut( __METHOD__ );
}
/**
*
* @todo document some more, and maybe clean up the code (some params redundant?)
*
- * @param object $row The database row corresponding to the line (or is it the previous line?).
- * @param object $next The database row corresponding to the next line (or is it this one?).
+ * @param Row $row The database row corresponding to the previous line.
+ * @param mixed $next The database row corresponding to the next line.
* @param int $counter Apparently a counter of what row number we're at, counted from the top row = 1.
* @param $notificationtimestamp
* @param bool $latest Whether this row corresponds to the page's latest revision.
}
$s .= " $link";
- $s .= ' '.$this->mSkin->revUserTools( $rev, true );
-
+ $s .= " <span class='history-user'>" . $this->mSkin->revUserTools( $rev, true ) . "</span>";
+
if( $row->rev_minor_edit ) {
- $s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') );
+ $s .= ' ' . Xml::element( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') );
}
- if ( !is_null( $size = $rev->getSize() ) ) {
+ if ( !is_null( $size = $rev->getSize() ) && $rev->userCan( Revision::DELETED_TEXT ) ) {
if ( $size == 0 )
$stxt = wfMsgHtml( 'historyempty' );
else
$s .= " <span class=\"history-size\">$stxt</span>";
}
- #getComment is safe, but this is better formatted
- if( $rev->isDeleted( Revision::DELETED_COMMENT ) ) {
- $s .= " <span class=\"history-deleted\"><span class=\"comment\">" .
- wfMsgHtml( 'rev-deleted-comment' ) . "</span></span>";
- } else {
- $s .= $this->mSkin->revComment( $rev );
- }
+ $s .= $this->mSkin->revComment( $rev, false, true );
if ($notificationtimestamp && ($row->rev_timestamp >= $notificationtimestamp)) {
$s .= ' <span class="updatedmarker">' . wfMsgHtml( 'updatedmarker' ) . '</span>';
}
#add blurb about text having been deleted
- if( $row->rev_deleted & Revision::DELETED_TEXT ) {
+ if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
$s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
}
return $s;
}
- /** @todo document */
+ /**
+ * Create a link to view this revision of the page
+ * @param Revision $rev
+ * @returns string
+ */
function revLink( $rev ) {
global $wgLang;
$date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
return $link;
}
- /** @todo document */
+ /**
+ * Create a diff-to-current link for this revision for this page
+ * @param Revision $rev
+ * @param Bool $latest, this is the latest revision of the page?
+ * @returns string
+ */
function curLink( $rev, $latest ) {
$cur = $this->message['cur'];
if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
}
}
- /** @todo document */
- function lastLink( $rev, $next, $counter ) {
+ /**
+ * Create a diff-to-previous link for this revision for this page.
+ * @param Revision $prevRev, the previous revision
+ * @param mixed $next, the newer revision
+ * @param int $counter, what row on the history list this is
+ * @returns string
+ */
+ function lastLink( $prevRev, $next, $counter ) {
$last = $this->message['last'];
- if ( is_null( $next ) ) {
+ # $next may either be a Row, null, or "unkown"
+ $nextRev = is_object($next) ? new Revision( $next ) : $next;
+ if( is_null($next) ) {
# Probably no next row
return $last;
- } elseif ( $next === 'unknown' ) {
+ } elseif( $next === 'unknown' ) {
# Next row probably exists but is unknown, use an oldid=prev link
return $this->mSkin->makeKnownLinkObj(
$this->mTitle,
$last,
- "diff=" . $rev->getId() . "&oldid=prev" );
- } elseif( !$rev->userCan( Revision::DELETED_TEXT ) ) {
+ "diff=" . $prevRev->getId() . "&oldid=prev" );
+ } elseif( !$prevRev->userCan(Revision::DELETED_TEXT) || !$nextRev->userCan(Revision::DELETED_TEXT) ) {
return $last;
} else {
return $this->mSkin->makeKnownLinkObj(
$this->mTitle,
$last,
- "diff=" . $rev->getId() . "&oldid={$next->rev_id}"
+ "diff=" . $prevRev->getId() . "&oldid={$next->rev_id}"
/*,
'',
'',
function getLatestId() {
if( is_null( $this->mLatestId ) ) {
$id = $this->mTitle->getArticleID();
- $db = wfGetDB(DB_SLAVE);
+ $db = wfGetDB( DB_SLAVE );
$this->mLatestId = $db->selectField( 'page',
"page_latest",
array( 'page_id' => $id ),
- 'PageHistory::getLatestID' );
+ __METHOD__ );
}
return $this->mLatestId;
}
* used by the main UI but that's now handled by the pager.
*/
function fetchRevisions($limit, $offset, $direction) {
- $fname = 'PageHistory::fetchRevisions';
-
$dbr = wfGetDB( DB_SLAVE );
if ($direction == PageHistory::DIR_PREV)
'revision',
Revision::selectFields(),
array_merge(array("rev_page=$page_id"), $offsets),
- $fname,
+ __METHOD__,
array('ORDER BY' => "rev_timestamp $dirs",
'USE INDEX' => 'page_timestamp', 'LIMIT' => $limit)
);
/** @todo document */
function getNotificationTimestamp() {
global $wgUser, $wgShowUpdatedMarker;
- $fname = 'PageHistory::getNotficationTimestamp';
if ($this->mNotificationTimestamp !== NULL)
return $this->mNotificationTimestamp;
'wl_title' => $this->mTitle->getDBkey(),
'wl_user' => $wgUser->getID()
),
- $fname);
+ __METHOD__ );
// Don't use the special value reserved for telling whether the field is filled
if ( is_null( $this->mNotificationTimestamp ) ) {