From 01dc25b41570ccdddd586c5caad532b6887012dc Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 15 Oct 2007 13:50:43 +0000 Subject: [PATCH] API: * Making apprtype and apprlevel accept multiple values * Adding apdir parameter that allows for reverse-sorting page titles --- RELEASE-NOTES | 2 ++ includes/api/ApiQueryAllpages.php | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 88205e18ee..544d594de3 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -128,6 +128,8 @@ Full API documentation is available at http://www.mediawiki.org/wiki/API as 'edit', 'new', 'log' instead of 0, 1, 2, respectively. * Compatibility fix for PHP 5.0.x. * Add rctype parameter to list=recentchanges that filters by type +* Add apprtype and apprlevel parameters to filter list=allpages by protection types and levels +* Add apdir parameter to enable listing all pages from Z to A === Languages updated in 1.12 === diff --git a/includes/api/ApiQueryAllpages.php b/includes/api/ApiQueryAllpages.php index a76e4ea321..8f7daecc24 100644 --- a/includes/api/ApiQueryAllpages.php +++ b/includes/api/ApiQueryAllpages.php @@ -86,6 +86,8 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { $prlevel = $params['prlevel']; if (!is_null($prlevel) && $prlevel != '' && $prlevel != '*') $this->addWhereFld('pr_level', $prlevel); + + $this->addOption('DISTINCT'); $forceNameTitleIndex = false; @@ -110,7 +112,8 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { $limit = $params['limit']; $this->addOption('LIMIT', $limit+1); - $this->addOption('ORDER BY', 'page_namespace, page_title'); + $this->addOption('ORDER BY', 'page_namespace, page_title' . + ($params['dir'] == 'ZtoA' ? ' DESC' : '')); $res = $this->select(__METHOD__); @@ -169,9 +172,11 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { ), 'prtype' => array ( ApiBase :: PARAM_TYPE => $wgRestrictionTypes, + ApiBase :: PARAM_ISMULTI => true ), 'prlevel' => array ( ApiBase :: PARAM_TYPE => $wgRestrictionLevels, + ApiBase :: PARAM_ISMULTI => true ), 'limit' => array ( ApiBase :: PARAM_DFLT => 10, @@ -179,6 +184,13 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { ApiBase :: PARAM_MIN => 1, ApiBase :: PARAM_MAX => ApiBase :: LIMIT_BIG1, ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2 + ), + 'dir' => array ( + ApiBase :: PARAM_DFLT => 'AtoZ', + ApiBase :: PARAM_TYPE => array ( + 'AtoZ', + 'ZtoA' + ) ) ); } @@ -189,6 +201,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { 'prefix' => 'Search for all page titles that begin with this value.', 'namespace' => 'The namespace to enumerate.', 'filterredir' => 'Which pages to list.', + 'dir' => 'The direction in which to list', 'minsize' => 'Limit to pages with at least this many bytes', 'maxsize' => 'Limit to pages with at most this many bytes', 'prtype' => 'Limit to protected pages only', -- 2.20.1