r55466 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55465‎ | r55466 | r55467 >
Date:06:36, 22 August 2009
Author:dale
Status:resolved (Comments)
Tags:
Comment:
hard coded requested imageinfo prop in api upload result (to avoid static call to non-static: ApiQueryImageInfo::getAllowedParams();
Modified paths:
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiUpload.php
@@ -237,13 +237,13 @@
238238 $warnings = $this->mUpload->checkWarnings();
239239 if( $warnings ) {
240240 $this->getResult()->setIndexedTagName( $warnings, 'warning' );
241 - //also add index to duplicate:
 241+ //also add index to duplicate:
242242 if(isset($warnings['duplicate']))
243243 $this->getResult()->setIndexedTagName( $warnings['duplicate'], 'duplicate');
244 -
 244+
245245 if(isset($warnings['exists']))
246246 $this->getResult()->setIndexedTagName( $warnings['exists'], 'exists');
247 -
 247+
248248 $result['result'] = 'Warning';
249249 $result['warnings'] = $warnings;
250250 if( isset( $result['filewasdeleted'] ) )
@@ -274,13 +274,22 @@
275275
276276 // Append imageinfo to the result
277277
278 - // might be a cleaner way to call this:
279 - $imParam = ApiQueryImageInfo::getAllowedParams();
280 - $imProp = $imParam['prop'][ApiBase::PARAM_TYPE];
281 - $result['imageinfo'] = ApiQueryImageInfo::getInfo( $file,
282 - array_flip( $imProp ),
283 - $this->getResult() );
 278+ //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');
 289+ $result['imageinfo'] = ApiQueryImageInfo::getInfo( $file,
 290+ array_flip( $imParam ),
 291+ $this->getResult() );
284292
 293+
285294 return $result;
286295 }
287296

Comments

#Comment by Bryan (talk | contribs)   20:37, 8 September 2009

Not ideal, so added a static method in r55606.

Status & tagging log