Fixed bogus $conds in r91327
authorAaron Schulz <aaron@users.mediawiki.org>
Fri, 1 Jul 2011 23:46:20 +0000 (23:46 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Fri, 1 Jul 2011 23:46:20 +0000 (23:46 +0000)
includes/Revision.php

index fa560d3..93e6a05 100644 (file)
@@ -40,7 +40,7 @@ class Revision {
        public static function newFromTitle( $title, $id = 0 ) {
                $conds = array(
                        'page_namespace' => $title->getNamespace(),
-                       'page_title' => $title->getDBkey()
+                       'page_title'     => $title->getDBkey()
                );
                if ( $id ) {
                        // Use the specified ID
@@ -73,7 +73,7 @@ class Revision {
        public static function newFromPageId( $pageId, $revId = 0 ) {
                $conds = array( 'page_id' => $pageId );
                if ( $revId ) {
-                       $conds['rev_id'] = $pageId;
+                       $conds['rev_id'] = $revId;
                } elseif ( wfGetLB()->getServerCount() > 1 ) {
                        // Get the latest revision ID from the master
                        $dbw = wfGetDB( DB_MASTER );
@@ -85,6 +85,7 @@ class Revision {
                } else {
                        $conds[] = 'rev_id = page_latest';
                }
+               $conds[] = 'page_id=rev_page';
                return Revision::newFromConds( $conds );
        }