From c12ded86607c0b0f3159284175bae29bf36b1b7e Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Fri, 1 Jul 2005 09:42:56 +0000 Subject: [PATCH] * (bug 2644) "cur" diff links in page history should specify current ID explicitly. --- RELEASE-NOTES | 2 ++ includes/PageHistory.php | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7325501bc8..ac1ccf7039 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -435,6 +435,8 @@ Various bugfixes, small features, and a few experimental things: * (bug 619) Don't use incompatible diff3 executable on non-Linux systems. * (bug 2631) Fix Hebrew namespaces. * (bug 2630) Indicate no-longer-valid cached entries in BrokenRedirects list +* (bug 2644) "cur" diff links in page history should specify current ID + explicitly. === Caveats === diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 06c99eab5b..9b5ded009c 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -276,7 +276,8 @@ class PageHistory { return $this->mSkin->makeKnownLinkObj( $this->mTitle, $cur, - 'diff=0&oldid=' . $row->rev_id ); + 'diff=' . $this->getLatestID($this->mTitle->getArticleID()) + . '&oldid=' . $row->rev_id ); } } @@ -342,7 +343,7 @@ class PageHistory { function getLatestOffset($id) { return $this->getExtremeOffset( $id, 'max' ); } - + function getEarliestOffset($id) { return $this->getExtremeOffset( $id, 'min' ); } @@ -355,6 +356,14 @@ class PageHistory { 'PageHistory::getExtremeOffset' ); } + function getLatestID( $id ) { + $db =& wfGetDB(DB_SLAVE); + return $db->selectField( 'revision', + "max(rev_id)", + array( 'rev_page' => $id ), + 'PageHistory::getLatestID' ); + } + function getLastOffsetForPaging( $id, $step = 50 ) { $db =& wfGetDB(DB_SLAVE); $revision = $db->tableName( 'revision' ); @@ -420,7 +429,6 @@ class PageHistory { $result = array(); while (($obj = $db->fetchObject($res)) != NULL) $result[] = $obj; -wfdebug("limits=$limits offset=$offsets got=".count($result)."\n"); return $result; } @@ -491,7 +499,7 @@ wfdebug("limits=$limits offset=$offsets got=".count($result)."\n"); } $bits = implode($urls, ' | '); - + wfDebug("latestShown=$latestShown latestTimestamp=$latestTimestamp\n"); if( $latestShown < $latestTimestamp ) { $prevtext = "".wfMsgHtml("prevn", $limit).""; -- 2.20.1