From e0542e1cf97a1f8fd7876397520d8a805b68d056 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sat, 14 Feb 2009 14:56:20 +0000 Subject: [PATCH] API: Make information about the main module (ApiMain) and the pageset module (ApiPageSet) available through action=paraminfo --- RELEASE-NOTES | 1 + includes/api/ApiParamInfo.php | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7d0c7407de..9059596ce1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -200,6 +200,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 17357) Added movesubpages parameter to action=move * (bug 17433) Added bot flag to list=watchlist&wlprop=flags output * (bug 16740) Added list=protectedtitles +* Added mainmodule and pagesetmodule parameters to action=paraminfo === Languages updated in 1.15 === diff --git a/includes/api/ApiParamInfo.php b/includes/api/ApiParamInfo.php index 75c2c2d0a4..7bc73b9cc6 100644 --- a/includes/api/ApiParamInfo.php +++ b/includes/api/ApiParamInfo.php @@ -41,6 +41,7 @@ class ApiParamInfo extends ApiBase { // Get parameters $params = $this->extractRequestParams(); $result = $this->getResult(); + $queryObj = new ApiQuery($this->getMain(), 'query'); $r = array(); if(is_array($params['modules'])) { @@ -61,7 +62,6 @@ class ApiParamInfo extends ApiBase { } if(is_array($params['querymodules'])) { - $queryObj = new ApiQuery($this->getMain(), 'query'); $qmodArr = $queryObj->getModules(); foreach($params['querymodules'] as $qm) { @@ -77,6 +77,13 @@ class ApiParamInfo extends ApiBase { } $result->setIndexedTagName($r['querymodules'], 'module'); } + if($params['mainmodule']) + $r['mainmodule'] = $this->getClassInfo($this->getMain()); + if($params['pagesetmodule']) + { + $pageSet = new ApiPageSet($queryObj); + $r['pagesetmodule'] = $this->getClassInfo($pageSet); + } $result->addValue(null, $this->getModuleName(), $r); } @@ -147,7 +154,9 @@ class ApiParamInfo extends ApiBase { ), 'querymodules' => array( ApiBase :: PARAM_ISMULTI => true - ) + ), + 'mainmodule' => false, + 'pagesetmodule' => false, ); } @@ -155,6 +164,8 @@ class ApiParamInfo extends ApiBase { return array ( 'modules' => 'List of module names (value of the action= parameter)', 'querymodules' => 'List of query module names (value of prop=, meta= or list= parameter)', + 'mainmodule' => 'Get information about the main (top-level) module as well', + 'pagesetmodule' => 'Get information about the pageset module (providing titles= and friends) as well', ); } -- 2.20.1