(bug 33304) Fix ApiQueryAllPages and old indef protections
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 30 Jan 2013 00:57:56 +0000 (19:57 -0500)
committerReedy <reedy@wikimedia.org>
Thu, 7 Mar 2013 03:03:49 +0000 (03:03 +0000)
In the query to find only protected pages, ApiQueryAllPages includes a
clause to make sure it doesn't find expired protections. But it doesn't
take into account the possibility that the protection might be an old
infinite protection where the expiry is represented as NULL instead of
'infinity'.

Note this may not close the whole bug; that remains to be determined.

Bug: 33304
Change-Id: If85591986a19bf78f7d56ad60d251fbc450ac451

RELEASE-NOTES-1.21
includes/api/ApiQueryAllPages.php

index 17bca70..26a7d07 100644 (file)
@@ -256,6 +256,7 @@ production.
 * (bug 44244) prop=info may now return the number of people watching each page.
 * (bug 33304) list=allpages will no longer return duplicate entries when
   querying protection.
+* (bug 33304) list=allpages will now find really old indefinite protections.
 
 === API internal changes in 1.21 ===
 * For debugging only, a new global $wgDebugAPI removes many API restrictions when true.
index 1667a85..5cf0c0b 100644 (file)
@@ -117,7 +117,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                if ( count( $params['prtype'] ) || $params['prexpiry'] != 'all' ) {
                        $this->addTables( 'page_restrictions' );
                        $this->addWhere( 'page_id=pr_page' );
-                       $this->addWhere( 'pr_expiry>' . $db->addQuotes( $db->timestamp() ) );
+                       $this->addWhere( "pr_expiry > {$db->addQuotes( $db->timestamp() )} OR pr_expiry IS NULL" );
 
                        if ( count( $params['prtype'] ) ) {
                                $this->addWhereFld( 'pr_type', $params['prtype'] );