r55606 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55605‎ | r55606 | r55607 >
Date:17:30, 26 August 2009
Author:btongminh
Status:ok
Tags:
Comment:
Unify properties in ApiQueryAllimages, ApiQueryImageinfo and ApiUpload.
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryAllimages.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryImageInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryAllimages.php
@@ -168,18 +168,7 @@
169169 'sha1' => null,
170170 'sha1base36' => null,
171171 'prop' => array (
172 - ApiBase :: PARAM_TYPE => array(
173 - 'timestamp',
174 - 'user',
175 - 'comment',
176 - 'url',
177 - 'size',
178 - 'dimensions', // Obsolete
179 - 'mime',
180 - 'sha1',
181 - 'metadata',
182 - 'bitdepth',
183 - ),
 172+ ApiBase :: PARAM_TYPE => ApiQueryImageInfo::getPropertyNames(),
184173 ApiBase :: PARAM_DFLT => 'timestamp|url',
185174 ApiBase :: PARAM_ISMULTI => true
186175 )
Index: trunk/phase3/includes/api/ApiQueryImageInfo.php
@@ -250,18 +250,7 @@
251251 'prop' => array (
252252 ApiBase :: PARAM_ISMULTI => true,
253253 ApiBase :: PARAM_DFLT => 'timestamp|user',
254 - ApiBase :: PARAM_TYPE => array (
255 - 'timestamp',
256 - 'user',
257 - 'comment',
258 - 'url',
259 - 'size',
260 - 'sha1',
261 - 'mime',
262 - 'metadata',
263 - 'archivename',
264 - 'bitdepth',
265 - )
 254+ ApiBase :: PARAM_TYPE => self::getPropertyNames()
266255 ),
267256 'limit' => array(
268257 ApiBase :: PARAM_TYPE => 'limit',
@@ -287,6 +276,25 @@
288277 'continue' => null,
289278 );
290279 }
 280+
 281+ /**
 282+ * Returns all possible parameters to iiprop
 283+ */
 284+ public static function getPropertyNames() {
 285+ return array (
 286+ 'timestamp',
 287+ 'user',
 288+ 'comment',
 289+ 'url',
 290+ 'size',
 291+ 'dimensions', // For backwards compatibility with Allimages
 292+ 'sha1',
 293+ 'mime',
 294+ 'metadata',
 295+ 'archivename',
 296+ 'bitdepth',
 297+ );
 298+ }
291299
292300 public function getParamDescription() {
293301 return array (
Index: trunk/phase3/includes/api/ApiUpload.php
@@ -275,16 +275,7 @@
276276 // Append imageinfo to the result
277277
278278 //get all the image properties:
279 - $imParam = Array('timestamp',
280 - 'user',
281 - 'comment',
282 - 'url',
283 - 'size',
284 - 'sha1',
285 - 'mime',
286 - 'metadata',
287 - 'archivename',
288 - 'bitdepth');
 279+ $imParam = ApiQueryImageInfo::getPropertyNames();
289280 $result['imageinfo'] = ApiQueryImageInfo::getInfo( $file,
290281 array_flip( $imParam ),
291282 $this->getResult() );

Status & tagging log