From 576129dbd8543b2c9b5d6c68250b6f28f54c4525 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 13 Mar 2011 17:16:07 +0000 Subject: [PATCH] * (bug 27340) API: Allow listing of "small" categories --- RELEASE-NOTES | 1 + includes/api/ApiQueryAllCategories.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d5272a9ab3..640d5e9da2 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -248,6 +248,7 @@ PHP if you have not done so prior to upgrading MediaWiki. in auto generated document, as it is on mw.org * (bug 27182) API: Add filter by prefix for meta=allmessages * (bug 27183) API: Add filter by customisation state for meta=allmessages +* (bug 27340) API: Allow listing of "small" categories === Languages updated in 1.18 === diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index c733703d09..f63ee87975 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -69,6 +69,10 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) ); $this->addWhereRange( 'cat_title', $dir, $from, $to ); + $min = $params['minpage']; + $max = $params['maxpage']; + $this->addWhereRange( 'cat_pages', $dir, $min, $max ); + if ( isset( $params['prefix'] ) ) { $this->addWhere( 'cat_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) ); } @@ -148,6 +152,14 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { 'descending' ), ), + 'minpage' => array( + ApiBase::PARAM_DFLT => null, + ApiBase::PARAM_TYPE => 'integer' + ), + 'maxpage' => array( + ApiBase::PARAM_DFLT => null, + ApiBase::PARAM_TYPE => 'integer' + ), 'limit' => array( ApiBase::PARAM_DFLT => 10, ApiBase::PARAM_TYPE => 'limit', @@ -169,6 +181,8 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { 'to' => 'The category to stop enumerating at', 'prefix' => 'Search for all category titles that begin with this value', 'dir' => 'Direction to sort in', + 'minpage' => 'Minimum number of category page members', + 'maxpage' => 'Maximum number of category page members', 'limit' => 'How many categories to return', 'prop' => array( 'Which properties to get', -- 2.20.1