From: Roan Kattouw Date: Fri, 8 May 2009 17:24:49 +0000 (+0000) Subject: API: (bug 18709) Missing descriptions for some parameters in action=paraminfo output X-Git-Tag: 1.31.0-rc.0~41842 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=5daf0db84711e7d527a27bd2ed3ce260bbb4cfad;p=lhc%2Fweb%2Fwiklou.git API: (bug 18709) Missing descriptions for some parameters in action=paraminfo output --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4b24b16a29..a4d2198072 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -133,7 +133,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Added PHP and database version to meta=siteinfo output * (bug 18533) Add readonly message to meta=siteinfo output * (bug 18518) Add clprop=hidden to prop=categories -* (bug 18710) Fixed internal error with empty parameter in ApiParamInfo +* (bug 18710) Fixed internal error with empty parameter in action=paraminfo +* (bug 18709) Missing descriptions for some parameters in action=paraminfo + output === Languages updated in 1.16 === diff --git a/includes/api/ApiParamInfo.php b/includes/api/ApiParamInfo.php index 4b2a2636d4..085ad8b6eb 100644 --- a/includes/api/ApiParamInfo.php +++ b/includes/api/ApiParamInfo.php @@ -93,7 +93,7 @@ class ApiParamInfo extends ApiBase { { $result = $this->getResult(); $retval['classname'] = get_class($obj); - $retval['description'] = (is_array($obj->getDescription()) ? implode("\n", $obj->getDescription()) : $obj->getDescription()); + $retval['description'] = implode("\n", (array)$obj->getDescription()); $retval['prefix'] = $obj->getModulePrefix(); if($obj->isReadMode()) $retval['readrights'] = ''; @@ -109,6 +109,8 @@ class ApiParamInfo extends ApiBase { foreach($allowedParams as $n => $p) { $a = array('name' => $n); + if(isset($paramDesc[$n])) + $a['description'] = implode("\n", (array)$paramDesc[$n]); if(!is_array($p)) { if(is_bool($p)) @@ -116,8 +118,16 @@ class ApiParamInfo extends ApiBase { $a['type'] = 'bool'; $a['default'] = ($p ? 'true' : 'false'); } - if(is_string($p)) - $a['default'] = $p; + else if(is_string($p) || is_null($p)) + { + $a['type'] = 'string'; + $a['default'] = strval($p); + } + else if(is_int($p)) + { + $a['type'] = 'integer'; + $a['default'] = intval($p); + } $retval['parameters'][] = $a; continue; } @@ -147,8 +157,6 @@ class ApiParamInfo extends ApiBase { $a['highmax'] = $p[ApiBase::PARAM_MAX2]; if(isset($p[ApiBase::PARAM_MIN])) $a['min'] = $p[ApiBase::PARAM_MIN]; - if(isset($paramDesc[$n])) - $a['description'] = (is_array($paramDesc[$n]) ? implode("\n", $paramDesc[$n]) : $paramDesc[$n]); $retval['parameters'][] = $a; } $result->setIndexedTagName($retval['parameters'], 'param');