Don't show orphaned revisions (will matter for bug 11402 later)
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 29 Oct 2008 04:17:31 +0000 (04:17 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 29 Oct 2008 04:17:31 +0000 (04:17 +0000)
includes/api/ApiPageSet.php
includes/api/ApiQueryRevisions.php

index 31a8d1e..67b261e 100644 (file)
@@ -457,9 +457,9 @@ class ApiPageSet extends ApiQueryBase {
                $pageids = array();
                $remaining = array_flip($revids);
 
-               $tables = array('revision');
+               $tables = array('revision','page');
                $fields = array('rev_id','rev_page');
-               $where = array('rev_deleted' => 0, 'rev_id' => $revids);
+               $where = array('rev_deleted' => 0, 'rev_id' => $revids,'rev_page = page_id');
 
                // Get pageIDs data from the `page` table
                $this->profileDBIn();
index 9a0166c..db3b9e9 100644 (file)
@@ -100,6 +100,8 @@ class ApiQueryRevisions extends ApiQueryBase {
 
                $this->addTables('revision');
                $this->addFields( Revision::selectFields() );
+               $this->addTables( 'page' );
+               $this->addWhere('page_id = rev_page');
 
                $prop = array_flip($prop);
 
@@ -114,8 +116,6 @@ class ApiQueryRevisions extends ApiQueryBase {
                $this->token = $token;
 
                if ( !is_null($this->token) || ( $this->fld_content && $this->expandTemplates ) || $pageCount > 0) {
-                       $this->addTables( 'page' );
-                       $this->addWhere('page_id=rev_page');
                        $this->addFields( Revision::selectPageFields() );
                }