X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiParamInfo.php;h=067b2f596867eb703b52cb49f4d4a851db2f0276;hb=50dee21f7a852e2cb4865b9ec83e272a25ab90c3;hp=7f9ad4c96c64eff3d96ac750fd5ab96c78e9075e;hpb=9f3dd6ceb2193056eea1b334bfca67d546594df1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiParamInfo.php b/includes/api/ApiParamInfo.php index 7f9ad4c96c..067b2f5968 100644 --- a/includes/api/ApiParamInfo.php +++ b/includes/api/ApiParamInfo.php @@ -34,7 +34,7 @@ class ApiParamInfo extends ApiBase { */ protected $queryObj; - public function __construct( $main, $action ) { + public function __construct( ApiMain $main, $action ) { parent::__construct( $main, $action ); $this->queryObj = new ApiQuery( $this->getMain(), 'query' ); } @@ -198,6 +198,10 @@ class ApiParamInfo extends ApiBase { $a['required'] = ''; } + if ( $n === 'token' && $obj->needsToken() ) { + $a['tokentype'] = $obj->needsToken(); + } + if ( isset( $p[ApiBase::PARAM_DFLT] ) ) { $type = $p[ApiBase::PARAM_TYPE]; if ( $type === 'boolean' ) { @@ -224,7 +228,13 @@ class ApiParamInfo extends ApiBase { } if ( isset( $p[ApiBase::PARAM_TYPE] ) ) { - $a['type'] = $p[ApiBase::PARAM_TYPE]; + if ( $p[ApiBase::PARAM_TYPE] === 'submodule' ) { + $a['type'] = $obj->getModuleManager()->getNames( $n ); + sort( $a['type'] ); + $a['submodules'] = ''; + } else { + $a['type'] = $p[ApiBase::PARAM_TYPE]; + } if ( is_array( $a['type'] ) ) { // To prevent sparse arrays from being serialized to JSON as objects $a['type'] = array_values( $a['type'] ); @@ -244,66 +254,6 @@ class ApiParamInfo extends ApiBase { } $result->setIndexedTagName( $retval['parameters'], 'param' ); - $props = $obj->getFinalResultProperties(); - $listResult = null; - if ( $props !== false ) { - $retval['props'] = array(); - - foreach ( $props as $prop => $properties ) { - $propResult = array(); - if ( $prop == ApiBase::PROP_LIST ) { - $listResult = $properties; - continue; - } - if ( $prop != ApiBase::PROP_ROOT ) { - $propResult['name'] = $prop; - } - $propResult['properties'] = array(); - - foreach ( $properties as $name => $p ) { - $propertyResult = array(); - - $propertyResult['name'] = $name; - - if ( !is_array( $p ) ) { - $p = array( ApiBase::PROP_TYPE => $p ); - } - - $propertyResult['type'] = $p[ApiBase::PROP_TYPE]; - - if ( is_array( $propertyResult['type'] ) ) { - $propertyResult['type'] = array_values( $propertyResult['type'] ); - $result->setIndexedTagName( $propertyResult['type'], 't' ); - } - - $nullable = null; - if ( isset( $p[ApiBase::PROP_NULLABLE] ) ) { - $nullable = $p[ApiBase::PROP_NULLABLE]; - } - - if ( $nullable === true ) { - $propertyResult['nullable'] = ''; - } - - $propResult['properties'][] = $propertyResult; - } - - $result->setIndexedTagName( $propResult['properties'], 'property' ); - $retval['props'][] = $propResult; - } - - // default is true for query modules, false for other modules, overridden by ApiBase::PROP_LIST - if ( $listResult === true || ( $listResult !== false && $obj instanceof ApiQueryBase ) ) { - $retval['listresult'] = ''; - } - - $result->setIndexedTagName( $retval['props'], 'prop' ); - } - - // Errors - $retval['errors'] = $this->parseErrors( $obj->getFinalPossibleErrors() ); - $result->setIndexedTagName( $retval['errors'], 'error' ); - return $retval; }