summaryrefslogtreecommitdiff
path: root/includes/api/ApiParamInfo.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiParamInfo.php')
-rw-r--r--includes/api/ApiParamInfo.php49
1 files changed, 45 insertions, 4 deletions
diff --git a/includes/api/ApiParamInfo.php b/includes/api/ApiParamInfo.php
index 4dcaf78e..2ab37ad1 100644
--- a/includes/api/ApiParamInfo.php
+++ b/includes/api/ApiParamInfo.php
@@ -195,6 +195,24 @@ class ApiParamInfo extends ApiBase {
}
$ret['prefix'] = $module->getModulePrefix();
+ $sourceInfo = $module->getModuleSourceInfo();
+ if ( $sourceInfo ) {
+ $ret['source'] = $sourceInfo['name'];
+ if ( isset( $sourceInfo['namemsg'] ) ) {
+ $ret['sourcename'] = $this->context->msg( $sourceInfo['namemsg'] )->text();
+ } else {
+ $ret['sourcename'] = $ret['source'];
+ }
+
+ $link = SpecialPage::getTitleFor( 'Version', 'License/' . $sourceInfo['name'] )->getFullUrl();
+ if ( isset( $sourceInfo['license-name'] ) ) {
+ $ret['licensetag'] = $sourceInfo['license-name'];
+ $ret['licenselink'] = (string)$link;
+ } elseif ( SpecialVersion::getExtLicenseFileName( dirname( $sourceInfo['path'] ) ) ) {
+ $ret['licenselink'] = (string)$link;
+ }
+ }
+
$this->formatHelpMessages( $ret, 'description', $module->getFinalDescription() );
foreach ( $module->getHelpFlags() as $flag ) {
@@ -273,14 +291,20 @@ class ApiParamInfo extends ApiBase {
if ( isset( $settings[ApiBase::PARAM_DFLT] ) ) {
switch ( $settings[ApiBase::PARAM_TYPE] ) {
case 'boolean':
- $item['default'] = ( $settings[ApiBase::PARAM_DFLT] ? 'true' : 'false' );
+ $item['default'] = (bool)$settings[ApiBase::PARAM_DFLT];
break;
case 'string':
+ case 'text':
+ case 'password':
$item['default'] = strval( $settings[ApiBase::PARAM_DFLT] );
break;
case 'integer':
+ case 'limit':
$item['default'] = intval( $settings[ApiBase::PARAM_DFLT] );
break;
+ case 'timestamp':
+ $item['default'] = wfTimestamp( TS_ISO_8601, $settings[ApiBase::PARAM_DFLT] );
+ break;
default:
$item['default'] = $settings[ApiBase::PARAM_DFLT];
break;
@@ -302,9 +326,23 @@ class ApiParamInfo extends ApiBase {
if ( isset( $settings[ApiBase::PARAM_TYPE] ) ) {
if ( $settings[ApiBase::PARAM_TYPE] === 'submodule' ) {
- $item['type'] = $module->getModuleManager()->getNames( $name );
- sort( $item['type'] );
- $item['submodules'] = true;
+ if ( isset( $settings[ApiBase::PARAM_SUBMODULE_MAP] ) ) {
+ ksort( $settings[ApiBase::PARAM_SUBMODULE_MAP] );
+ $item['type'] = array_keys( $settings[ApiBase::PARAM_SUBMODULE_MAP] );
+ $item['submodules'] = $settings[ApiBase::PARAM_SUBMODULE_MAP];
+ } else {
+ $item['type'] = $module->getModuleManager()->getNames( $name );
+ sort( $item['type'] );
+ $prefix = $module->isMain()
+ ? '' : ( $module->getModulePath() . '+' );
+ $item['submodules'] = array();
+ foreach ( $item['type'] as $v ) {
+ $item['submodules'][$v] = $prefix . $v;
+ }
+ }
+ if ( isset( $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX] ) ) {
+ $item['submoduleparamprefix'] = $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX];
+ }
} else {
$item['type'] = $settings[ApiBase::PARAM_TYPE];
}
@@ -323,6 +361,9 @@ class ApiParamInfo extends ApiBase {
if ( isset( $settings[ApiBase::PARAM_MIN] ) ) {
$item['min'] = $settings[ApiBase::PARAM_MIN];
}
+ if ( !empty( $settings[ApiBase::PARAM_RANGE_ENFORCE] ) ) {
+ $item['enforcerange'] = true;
+ }
if ( !empty( $settings[ApiBase::PARAM_HELP_MSG_INFO] ) ) {
$item['info'] = array();