Index: trunk/phase3/includes/api/ApiQuery.php |
— | — | @@ -179,7 +179,7 @@ |
180 | 180 | |
181 | 181 | /** |
182 | 182 | * Get the array mapping module names to class names |
183 | | - * @return array(modulename => classname) |
| 183 | + * @return array (modulename => classname) |
184 | 184 | */ |
185 | 185 | function getModules() { |
186 | 186 | return array_merge( $this->mQueryPropModules, $this->mQueryListModules, $this->mQueryMetaModules ); |
Index: trunk/phase3/includes/api/ApiParamInfo.php |
— | — | @@ -34,15 +34,21 @@ |
35 | 35 | */ |
36 | 36 | class ApiParamInfo extends ApiBase { |
37 | 37 | |
| 38 | + /** |
| 39 | + * @var ApiQuery |
| 40 | + */ |
| 41 | + protected $queryObj; |
| 42 | + |
38 | 43 | public function __construct( $main, $action ) { |
39 | 44 | parent::__construct( $main, $action ); |
| 45 | + $this->queryObj = new ApiQuery( $this->getMain(), 'query' ); |
40 | 46 | } |
41 | 47 | |
42 | 48 | public function execute() { |
43 | 49 | // Get parameters |
44 | 50 | $params = $this->extractRequestParams(); |
45 | 51 | $result = $this->getResult(); |
46 | | - $queryObj = new ApiQuery( $this->getMain(), 'query' ); |
| 52 | + |
47 | 53 | $r = array(); |
48 | 54 | if ( is_array( $params['modules'] ) ) { |
49 | 55 | $modArr = $this->getMain()->getModules(); |
— | — | @@ -60,7 +66,7 @@ |
61 | 67 | $result->setIndexedTagName( $r['modules'], 'module' ); |
62 | 68 | } |
63 | 69 | if ( is_array( $params['querymodules'] ) ) { |
64 | | - $qmodArr = $queryObj->getModules(); |
| 70 | + $qmodArr = $this->queryObj->getModules(); |
65 | 71 | $r['querymodules'] = array(); |
66 | 72 | foreach ( $params['querymodules'] as $qm ) { |
67 | 73 | if ( !isset( $qmodArr[$qm] ) ) { |
— | — | @@ -70,7 +76,7 @@ |
71 | 77 | $obj = new $qmodArr[$qm]( $this, $qm ); |
72 | 78 | $a = $this->getClassInfo( $obj ); |
73 | 79 | $a['name'] = $qm; |
74 | | - $a['querytype'] = $queryObj->getModuleType( $qm ); |
| 80 | + $a['querytype'] = $this->queryObj->getModuleType( $qm ); |
75 | 81 | $r['querymodules'][] = $a; |
76 | 82 | } |
77 | 83 | $result->setIndexedTagName( $r['querymodules'], 'module' ); |
— | — | @@ -79,7 +85,7 @@ |
80 | 86 | $r['mainmodule'] = $this->getClassInfo( $this->getMain() ); |
81 | 87 | } |
82 | 88 | if ( $params['pagesetmodule'] ) { |
83 | | - $pageSet = new ApiPageSet( $queryObj ); |
| 89 | + $pageSet = new ApiPageSet( $this->queryObj ); |
84 | 90 | $r['pagesetmodule'] = $this->getClassInfo( $pageSet ); |
85 | 91 | } |
86 | 92 | $result->addValue( null, $this->getModuleName(), $r ); |
— | — | @@ -219,12 +225,15 @@ |
220 | 226 | } |
221 | 227 | |
222 | 228 | public function getAllowedParams() { |
| 229 | + |
223 | 230 | return array( |
224 | 231 | 'modules' => array( |
225 | | - ApiBase::PARAM_ISMULTI => true |
| 232 | + ApiBase::PARAM_ISMULTI => true, |
| 233 | + ApiBase::PARAM_TYPE => array_keys( $this->getMain()->getModules() ), |
226 | 234 | ), |
227 | 235 | 'querymodules' => array( |
228 | | - ApiBase::PARAM_ISMULTI => true |
| 236 | + ApiBase::PARAM_ISMULTI => true, |
| 237 | + ApiBase::PARAM_TYPE => array_keys( $this->queryObj->getModules() ), |
229 | 238 | ), |
230 | 239 | 'mainmodule' => false, |
231 | 240 | 'pagesetmodule' => false, |