From: Brad Jorsch Date: Wed, 30 Jan 2013 01:32:26 +0000 (-0500) Subject: (bug 33304) Fix ApiQueryAllPages duplicate rows in protection query X-Git-Tag: 1.31.0-rc.0~20467 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=b7af187a78bb623c8be4d7f82d5e322702734429;p=lhc%2Fweb%2Fwiklou.git (bug 33304) Fix ApiQueryAllPages duplicate rows in protection query When querying for protection expiry without also querying protection type(s), DISTINCT is not added to the query. Fix that. Change-Id: I47d3ac1e0cfa6fa1fb0dc0089f5a01698b334cd5 --- diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index 4f38f3a6b5..303e0b0fe9 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -251,6 +251,8 @@ production. an error during parameter validation if the parameter is given but not recognized as an uploaded file. * (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. === 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 0c6692a3e7..1667a85a4c 100644 --- a/includes/api/ApiQueryAllPages.php +++ b/includes/api/ApiQueryAllPages.php @@ -135,8 +135,6 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { } elseif ( $params['prfiltercascade'] == 'noncascading' ) { $this->addWhereFld( 'pr_cascade', 0 ); } - - $this->addOption( 'DISTINCT' ); } $forceNameTitleIndex = false; @@ -146,6 +144,8 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { $this->addWhere( "pr_expiry != {$db->addQuotes( $db->getInfinity() )}" ); } + $this->addOption( 'DISTINCT' ); + } elseif ( isset( $params['prlevel'] ) ) { $this->dieUsage( 'prlevel may not be used without prtype', 'params' ); }