$obj = new $qmodArr[$qm]( $this, $qm );
$a = $this->getClassInfo( $obj );
$a['name'] = $qm;
+ $a['querytype'] = $queryObj->getModuleType( $qm );
$r['querymodules'][] = $a;
}
$result->setIndexedTagName( $r['querymodules'], 'module' );
}
/**
- * @param $obj ApiBase
+ * @param $obj ApiBase
* @return ApiResult
*/
function getClassInfo( $obj ) {
$result = $this->getResult();
$retval['classname'] = get_class( $obj );
$retval['description'] = implode( "\n", (array)$obj->getDescription() );
- $retval['examples'] = implode( "\n", (array)$obj->getExamples() );
+ $examples = (array)$obj->getExamples();
+ $retval['examples'] = implode( "\n", $examples );
$retval['version'] = implode( "\n", (array)$obj->getVersion() );
$retval['prefix'] = $obj->getModulePrefix();
return $retval;
}
+ $retval['helpurls'] = (array)$obj->getHelpUrls();
+ $result->setIndexedTagName( $retval['helpurls'], 'helpurl' );
+
+ $retval['allexamples'] = $examples;
+ $result->setIndexedTagName( $retval['allexamples'], 'example' );
+
$retval['parameters'] = array();
$paramDesc = $obj->getFinalParamDescription();
foreach ( $allowedParams as $n => $p ) {
//handle missing type
if ( !isset( $p[ApiBase::PARAM_TYPE] ) ) {
- $dflt = $p[ApiBase::PARAM_DFLT];
+ $dflt = isset( $p[ApiBase::PARAM_DFLT] ) ? $p[ApiBase::PARAM_DFLT] : null;
if ( is_bool( $dflt ) ) {
- $p[ApiBase::PARAM_TYPE] = 'bool';
+ $p[ApiBase::PARAM_TYPE] = 'boolean';
} elseif ( is_string( $dflt ) || is_null( $dflt ) ) {
$p[ApiBase::PARAM_TYPE] = 'string';
} elseif ( is_int( $dflt ) ) {
if ( isset( $p[ApiBase::PARAM_DFLT] ) ) {
$type = $p[ApiBase::PARAM_TYPE];
- if( $type === 'bool' ) {
+ if( $type === 'boolean' ) {
$a['default'] = ( $p[ApiBase::PARAM_DFLT] ? 'true' : 'false' );
} elseif( $type === 'string' ) {
$a['default'] = strval( $p[ApiBase::PARAM_DFLT] );
if ( isset( $p[ApiBase::PARAM_ISMULTI] ) && $p[ApiBase::PARAM_ISMULTI] ) {
$a['multi'] = '';
$a['limit'] = $this->getMain()->canApiHighLimits() ?
- ApiBase::LIMIT_SML2 :
- ApiBase::LIMIT_SML1;
+ ApiBase::LIMIT_SML2 :
+ ApiBase::LIMIT_SML1;
+ $a['lowlimit'] = ApiBase::LIMIT_SML1;
+ $a['highlimit'] = ApiBase::LIMIT_SML2;
}
if ( isset( $p[ApiBase::PARAM_ALLOW_DUPLICATES] ) && $p[ApiBase::PARAM_ALLOW_DUPLICATES] ) {
if ( isset( $p[ApiBase::PARAM_TYPE] ) ) {
$a['type'] = $p[ApiBase::PARAM_TYPE];
if ( is_array( $a['type'] ) ) {
+ $a['type'] = array_values( $a['type'] ); // to prevent sparse arrays from being serialized to JSON as objects
$result->setIndexedTagName( $a['type'], 't' );
}
}
// Errors
$retval['errors'] = $this->parseErrors( $obj->getPossibleErrors() );
-
$result->setIndexedTagName( $retval['errors'], 'error' );
return $retval;
);
}
+ public function getHelpUrls() {
+ return 'http://www.mediawiki.org/wiki/API:Parameter_information';
+ }
+
public function getVersion() {
return __CLASS__ . ': $Id$';
}