Index: trunk/phase3/includes/api/ApiParamInfo.php |
— | — | @@ -121,6 +121,26 @@ |
122 | 122 | if ( isset( $paramDesc[$n] ) ) { |
123 | 123 | $a['description'] = implode( "\n", (array)$paramDesc[$n] ); |
124 | 124 | } |
| 125 | + |
| 126 | + //handle shorthand |
| 127 | + if( !is_array( $p ) ) { |
| 128 | + $p = array( |
| 129 | + ApiBase::PARAM_DFLT => $p, |
| 130 | + ); |
| 131 | + } |
| 132 | + |
| 133 | + //handle missing type |
| 134 | + if ( !isset( $p[ApiBase::PARAM_TYPE] ) ) { |
| 135 | + $dflt = $p[ApiBase::PARAM_DFLT]; |
| 136 | + if ( is_bool( $dflt ) ) { |
| 137 | + $p[ApiBase::PARAM_TYPE] = 'bool'; |
| 138 | + } elseif ( is_string( $dflt ) || is_null( $dflt ) ) { |
| 139 | + $p[ApiBase::PARAM_TYPE] = 'string'; |
| 140 | + } elseif ( is_int( $dflt ) ) { |
| 141 | + $p[ApiBase::PARAM_TYPE] = 'integer'; |
| 142 | + } |
| 143 | + } |
| 144 | + |
125 | 145 | if ( isset( $p[ApiBase::PARAM_DEPRECATED] ) && $p[ApiBase::PARAM_DEPRECATED] ) { |
126 | 146 | $a['deprecated'] = ''; |
127 | 147 | } |
— | — | @@ -128,24 +148,18 @@ |
129 | 149 | $a['required'] = ''; |
130 | 150 | } |
131 | 151 | |
132 | | - if ( !is_array( $p ) ) { |
133 | | - if ( is_bool( $p ) ) { |
134 | | - $a['type'] = 'bool'; |
135 | | - $a['default'] = ( $p ? 'true' : 'false' ); |
136 | | - } elseif ( is_string( $p ) || is_null( $p ) ) { |
137 | | - $a['type'] = 'string'; |
138 | | - $a['default'] = strval( $p ); |
139 | | - } elseif ( is_int( $p ) ) { |
140 | | - $a['type'] = 'integer'; |
141 | | - $a['default'] = intval( $p ); |
| 152 | + if ( isset( $p[ApiBase::PARAM_DFLT] ) ) { |
| 153 | + $type = $p[ApiBase::PARAM_TYPE]; |
| 154 | + if( $type === 'bool' ) { |
| 155 | + $a['default'] = ( $p[ApiBase::PARAM_DFLT] ? 'true' : 'false' ); |
| 156 | + } elseif( $type === 'string' ) { |
| 157 | + $a['default'] = strval( $p[ApiBase::PARAM_DFLT] ); |
| 158 | + } elseif( $type === 'integer' ) { |
| 159 | + $a['default'] = intval( $p[ApiBase::PARAM_DFLT] ); |
| 160 | + } else { |
| 161 | + $a['default'] = $p[ApiBase::PARAM_DFLT]; |
142 | 162 | } |
143 | | - $retval['parameters'][] = $a; |
144 | | - continue; |
145 | 163 | } |
146 | | - |
147 | | - if ( isset( $p[ApiBase::PARAM_DFLT] ) ) { |
148 | | - $a['default'] = $p[ApiBase::PARAM_DFLT]; |
149 | | - } |
150 | 164 | if ( isset( $p[ApiBase::PARAM_ISMULTI] ) && $p[ApiBase::PARAM_ISMULTI] ) { |
151 | 165 | $a['multi'] = ''; |
152 | 166 | $a['limit'] = $this->getMain()->canApiHighLimits() ? |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -329,6 +329,8 @@ |
330 | 330 | action=import&xml= |
331 | 331 | * (bug 28391) action=feedwatchlist&allrev should be a bool |
332 | 332 | * (bug 28364) add registration date to meta=userinfo |
| 333 | +* (bug 28254) action=paraminfo: Extract type from PARAM_DFLT if |
| 334 | + PARAM_TYPE is not set |
333 | 335 | |
334 | 336 | === Languages updated in 1.18 === |
335 | 337 | |