Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php |
— | — | @@ -55,10 +55,22 @@ |
56 | 56 | private function run( $resultPageSet = null ) { |
57 | 57 | $params = $this->extractRequestParams(); |
58 | 58 | |
59 | | - $categoryTitle = Title::newFromText( $params['title'] ); |
| 59 | + $this->requireOnlyOneParameter( $params, 'title', 'pageid' ); |
60 | 60 | |
61 | | - if ( is_null( $categoryTitle ) || $categoryTitle->getNamespace() != NS_CATEGORY ) { |
62 | | - $this->dieUsage( 'The category name you entered is not valid', 'invalidcategory' ); |
| 61 | + if ( isset( $params['title'] ) ) { |
| 62 | + $categoryTitle = Title::newFromText( $params['title'] ); |
| 63 | + |
| 64 | + if ( is_null( $categoryTitle ) || $categoryTitle->getNamespace() != NS_CATEGORY ) { |
| 65 | + $this->dieUsage( 'The category name you entered is not valid', 'invalidcategory' ); |
| 66 | + } |
| 67 | + } elseif( isset( $params['pageid'] ) ) { |
| 68 | + $categoryTitle = Title::newFromID( $params['pageid'] ); |
| 69 | + |
| 70 | + if ( !$categoryTitle ) { |
| 71 | + $this->dieUsageMsg( array( 'nosuchpageid', $params['pageid'] ) ); |
| 72 | + } elseif ( $categoryTitle->getNamespace() != NS_CATEGORY ) { |
| 73 | + $this->dieUsage( 'The category name you entered is not valid', 'invalidcategory' ); |
| 74 | + } |
63 | 75 | } |
64 | 76 | |
65 | 77 | $prop = array_flip( $params['prop'] ); |
— | — | @@ -208,8 +220,10 @@ |
209 | 221 | return array( |
210 | 222 | 'title' => array( |
211 | 223 | ApiBase::PARAM_TYPE => 'string', |
212 | | - ApiBase::PARAM_REQUIRED => true |
213 | 224 | ), |
| 225 | + 'pageid' => array( |
| 226 | + ApiBase::PARAM_TYPE => 'integer' |
| 227 | + ), |
214 | 228 | 'prop' => array( |
215 | 229 | ApiBase::PARAM_DFLT => 'ids|title', |
216 | 230 | ApiBase::PARAM_ISMULTI => true, |
— | — | @@ -261,7 +275,8 @@ |
262 | 276 | global $wgMiserMode; |
263 | 277 | $p = $this->getModulePrefix(); |
264 | 278 | $desc = array( |
265 | | - 'title' => 'Which category to enumerate (required). Must include Category: prefix', |
| 279 | + 'title' => 'Which category to enumerate (required). Must include Category: prefix. Cannot be used together with cmpageid', |
| 280 | + 'pageid' => 'Page ID of the category to enumerate. Cannot be used together with cmtitle', |
266 | 281 | 'prop' => array( |
267 | 282 | 'What pieces of information to include', |
268 | 283 | ' ids - Adds the page ID', |
— | — | @@ -298,6 +313,7 @@ |
299 | 314 | array( 'code' => 'notitle', 'info' => 'The cmtitle parameter is required' ), |
300 | 315 | array( 'code' => 'invalidcategory', 'info' => 'The category name you entered is not valid' ), |
301 | 316 | array( 'code' => 'badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ), |
| 317 | + array( 'nosuchpageid', 'pageid' ), |
302 | 318 | ) ); |
303 | 319 | } |
304 | 320 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -71,6 +71,7 @@ |
72 | 72 | * (bug 26559) list=allusers auprop=rights does not match list=users usprop=rights |
73 | 73 | * (bug 26560) On allusers if limit < total number of users, last user gets duplicate |
74 | 74 | * (bug 25135) add "normalized" to action=parse |
| 75 | +* (bug 26460) Add support for listing category members by category pageid |
75 | 76 | |
76 | 77 | === Languages updated in 1.18 === |
77 | 78 | |