From: Brad Jorsch Date: Wed, 30 Jan 2013 00:57:56 +0000 (-0500) Subject: (bug 33304) Fix ApiQueryAllPages and old indef protections X-Git-Tag: 1.31.0-rc.0~20445 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=3d0f6878f355ff38f5822e37121661352d272fe8;p=lhc%2Fweb%2Fwiklou.git (bug 33304) Fix ApiQueryAllPages and old indef protections 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 --- diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index 17bca70fb0..26a7d0707c 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -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. diff --git a/includes/api/ApiQueryAllPages.php b/includes/api/ApiQueryAllPages.php index 1667a85a4c..5cf0c0b7b2 100644 --- a/includes/api/ApiQueryAllPages.php +++ b/includes/api/ApiQueryAllPages.php @@ -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'] );