* (bug 2644) "cur" diff links in page history should specify current ID
authorRiver Tarnell <kateturner@users.mediawiki.org>
Fri, 1 Jul 2005 09:42:56 +0000 (09:42 +0000)
committerRiver Tarnell <kateturner@users.mediawiki.org>
Fri, 1 Jul 2005 09:42:56 +0000 (09:42 +0000)
  explicitly.

RELEASE-NOTES
includes/PageHistory.php

index 7325501..ac1ccf7 100644 (file)
@@ -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 ===
index 06c99ea..9b5ded0 100644 (file)
@@ -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 = "<a href=\"$prevurl\">".wfMsgHtml("prevn", $limit)."</a>";