*/
class ApiParamInfo extends ApiBase {
+ /**
+ * @var ApiQuery
+ */
+ protected $queryObj;
+
public function __construct( $main, $action ) {
parent::__construct( $main, $action );
+ $this->queryObj = new ApiQuery( $this->getMain(), 'query' );
}
public function execute() {
// Get parameters
$params = $this->extractRequestParams();
$result = $this->getResult();
- $queryObj = new ApiQuery( $this->getMain(), 'query' );
+
$r = array();
if ( is_array( $params['modules'] ) ) {
$modArr = $this->getMain()->getModules();
$result->setIndexedTagName( $r['modules'], 'module' );
}
if ( is_array( $params['querymodules'] ) ) {
- $qmodArr = $queryObj->getModules();
+ $qmodArr = $this->queryObj->getModules();
$r['querymodules'] = array();
foreach ( $params['querymodules'] as $qm ) {
if ( !isset( $qmodArr[$qm] ) ) {
$obj = new $qmodArr[$qm]( $this, $qm );
$a = $this->getClassInfo( $obj );
$a['name'] = $qm;
- $a['querytype'] = $queryObj->getModuleType( $qm );
+ $a['querytype'] = $this->queryObj->getModuleType( $qm );
$r['querymodules'][] = $a;
}
$result->setIndexedTagName( $r['querymodules'], 'module' );
$r['mainmodule'] = $this->getClassInfo( $this->getMain() );
}
if ( $params['pagesetmodule'] ) {
- $pageSet = new ApiPageSet( $queryObj );
+ $pageSet = new ApiPageSet( $this->queryObj );
$r['pagesetmodule'] = $this->getClassInfo( $pageSet );
}
$result->addValue( null, $this->getModuleName(), $r );
}
public function getAllowedParams() {
+
return array(
'modules' => array(
- ApiBase::PARAM_ISMULTI => true
+ ApiBase::PARAM_ISMULTI => true,
+ ApiBase::PARAM_TYPE => array_keys( $this->getMain()->getModules() ),
),
'querymodules' => array(
- ApiBase::PARAM_ISMULTI => true
+ ApiBase::PARAM_ISMULTI => true,
+ ApiBase::PARAM_TYPE => array_keys( $this->queryObj->getModules() ),
),
'mainmodule' => false,
'pagesetmodule' => false,