r50338 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50337‎ | r50338 | r50339 >
Date:17:24, 8 May 2009
Author:catrope
Status:ok
Tags:
Comment:
API: (bug 18709) Missing descriptions for some parameters in action=paraminfo output
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiParamInfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiParamInfo.php
@@ -93,7 +93,7 @@
9494 {
9595 $result = $this->getResult();
9696 $retval['classname'] = get_class($obj);
97 - $retval['description'] = (is_array($obj->getDescription()) ? implode("\n", $obj->getDescription()) : $obj->getDescription());
 97+ $retval['description'] = implode("\n", (array)$obj->getDescription());
9898 $retval['prefix'] = $obj->getModulePrefix();
9999 if($obj->isReadMode())
100100 $retval['readrights'] = '';
@@ -109,6 +109,8 @@
110110 foreach($allowedParams as $n => $p)
111111 {
112112 $a = array('name' => $n);
 113+ if(isset($paramDesc[$n]))
 114+ $a['description'] = implode("\n", (array)$paramDesc[$n]);
113115 if(!is_array($p))
114116 {
115117 if(is_bool($p))
@@ -116,8 +118,16 @@
117119 $a['type'] = 'bool';
118120 $a['default'] = ($p ? 'true' : 'false');
119121 }
120 - if(is_string($p))
121 - $a['default'] = $p;
 122+ else if(is_string($p) || is_null($p))
 123+ {
 124+ $a['type'] = 'string';
 125+ $a['default'] = strval($p);
 126+ }
 127+ else if(is_int($p))
 128+ {
 129+ $a['type'] = 'integer';
 130+ $a['default'] = intval($p);
 131+ }
122132 $retval['parameters'][] = $a;
123133 continue;
124134 }
@@ -147,8 +157,6 @@
148158 $a['highmax'] = $p[ApiBase::PARAM_MAX2];
149159 if(isset($p[ApiBase::PARAM_MIN]))
150160 $a['min'] = $p[ApiBase::PARAM_MIN];
151 - if(isset($paramDesc[$n]))
152 - $a['description'] = (is_array($paramDesc[$n]) ? implode("\n", $paramDesc[$n]) : $paramDesc[$n]);
153161 $retval['parameters'][] = $a;
154162 }
155163 $result->setIndexedTagName($retval['parameters'], 'param');
Index: trunk/phase3/RELEASE-NOTES
@@ -133,7 +133,9 @@
134134 * Added PHP and database version to meta=siteinfo output
135135 * (bug 18533) Add readonly message to meta=siteinfo output
136136 * (bug 18518) Add clprop=hidden to prop=categories
137 -* (bug 18710) Fixed internal error with empty parameter in ApiParamInfo
 137+* (bug 18710) Fixed internal error with empty parameter in action=paraminfo
 138+* (bug 18709) Missing descriptions for some parameters in action=paraminfo
 139+ output
138140
139141 === Languages updated in 1.16 ===
140142

Status & tagging log