Index: trunk/phase3/includes/api/ApiQueryImageInfo.php |
— | — | @@ -267,13 +267,16 @@ |
268 | 268 | */ |
269 | 269 | static function getInfo( $file, $prop, $result, $thumbParams = null ) { |
270 | 270 | $vals = array(); |
| 271 | + // Timestamp is shown even if the file is revdelete'd in interface |
| 272 | + // so do same here. |
271 | 273 | if ( isset( $prop['timestamp'] ) ) { |
272 | 274 | $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $file->getTimestamp() ); |
273 | 275 | } |
274 | | - if ( isset( $prop['user'] ) || isset( $prop['userid'] ) ) { |
275 | | - if ( $file->isDeleted( File::DELETED_USER ) ) { |
276 | | - $vals['userhidden'] = ''; |
277 | | - } else { |
| 276 | + |
| 277 | + if ( $file->isDeleted( File::DELETED_USER ) ) { |
| 278 | + $vals['userhidden'] = ''; |
| 279 | + } else { |
| 280 | + if ( isset( $prop['user'] ) || isset( $prop['userid'] ) ) { |
278 | 281 | if ( isset( $prop['user'] ) ) { |
279 | 282 | $vals['user'] = $file->getUser(); |
280 | 283 | } |
— | — | @@ -285,6 +288,8 @@ |
286 | 289 | } |
287 | 290 | } |
288 | 291 | } |
| 292 | + // This is shown even if the file is revdelete'd in interface |
| 293 | + // so do same here. |
289 | 294 | if ( isset( $prop['size'] ) || isset( $prop['dimensions'] ) ) { |
290 | 295 | $vals['size'] = intval( $file->getSize() ); |
291 | 296 | $vals['width'] = intval( $file->getWidth() ); |
— | — | @@ -295,10 +300,25 @@ |
296 | 301 | $vals['pagecount'] = $pageCount; |
297 | 302 | } |
298 | 303 | } |
299 | | - if ( isset( $prop['url'] ) ) { |
300 | | - if ( $file->isDeleted( File::DELETED_FILE ) ) { |
301 | | - $vals['filehidden'] = ''; |
302 | | - } else { |
| 304 | + |
| 305 | + if ( $file->isDeleted( File::DELETED_COMMENT ) ) { |
| 306 | + $vals['commenthidden'] = ''; |
| 307 | + } else { |
| 308 | + if ( isset( $prop['parsedcomment'] ) ) { |
| 309 | + global $wgUser; |
| 310 | + $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( |
| 311 | + $file->getDescription(), $file->getTitle() ); |
| 312 | + } |
| 313 | + if ( isset( $prop['comment'] ) ) { |
| 314 | + $vals['comment'] = $file->getDescription(); |
| 315 | + } |
| 316 | + } |
| 317 | + |
| 318 | + |
| 319 | + if ( $file->isDeleted( File::DELETED_FILE ) ) { |
| 320 | + $vals['filehidden'] = ''; |
| 321 | + } else { |
| 322 | + if ( isset( $prop['url'] ) ) { |
303 | 323 | if ( !is_null( $thumbParams ) ) { |
304 | 324 | $mto = $file->transform( $thumbParams ); |
305 | 325 | if ( $mto && !$mto->isError() ) { |
— | — | @@ -325,60 +345,26 @@ |
326 | 346 | $vals['url'] = $file->getFullURL(); |
327 | 347 | $vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl() ); |
328 | 348 | } |
329 | | - } |
330 | | - if ( isset( $prop['comment'] ) ) { |
331 | | - if ( $file->isDeleted( File::DELETED_COMMENT ) ) { |
332 | | - $vals['commenthidden'] = ''; |
333 | | - } else { |
334 | | - $vals['comment'] = $file->getDescription(); |
335 | | - } |
336 | | - } |
337 | | - if ( isset( $prop['parsedcomment'] ) ) { |
338 | | - if ( $file->isDeleted( File::DELETED_COMMENT ) ) { |
339 | | - $vals['commenthidden'] = ''; |
340 | | - } else { |
341 | | - global $wgUser; |
342 | | - $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( |
343 | | - $file->getDescription(), $file->getTitle() ); |
344 | | - } |
345 | | - } |
346 | 349 | |
347 | | - if ( isset( $prop['sha1'] ) ) { |
348 | | - if ( $file->isDeleted( File::DELETED_FILE ) ) { |
349 | | - $vals['filehidden'] = ''; |
350 | | - } else { |
| 350 | + if ( isset( $prop['sha1'] ) ) { |
351 | 351 | $vals['sha1'] = wfBaseConvert( $file->getSha1(), 36, 16, 40 ); |
352 | 352 | } |
353 | | - } |
354 | | - if ( isset( $prop['metadata'] ) ) { |
355 | | - if ( $file->isDeleted( File::DELETED_FILE ) ) { |
356 | | - $vals['filehidden'] = ''; |
357 | | - } else { |
| 353 | + |
| 354 | + if ( isset( $prop['metadata'] ) ) { |
358 | 355 | $metadata = $file->getMetadata(); |
359 | 356 | $vals['metadata'] = $metadata ? self::processMetaData( unserialize( $metadata ), $result ) : null; |
360 | 357 | } |
361 | | - } |
362 | | - if ( isset( $prop['mime'] ) ) { |
363 | | - if ( $file->isDeleted( File::DELETED_FILE ) ) { |
364 | | - $vals['filehidden'] = ''; |
365 | | - } else { |
| 358 | + |
| 359 | + if ( isset( $prop['mime'] ) ) { |
366 | 360 | $vals['mime'] = $file->getMimeType(); |
367 | 361 | } |
368 | | - } |
369 | 362 | |
370 | | - if ( isset( $prop['archivename'] ) && $file->isOld() ) { |
371 | | - if ( $file->isDeleted( File::DELETED_FILE ) ) { |
372 | | - $vals['filehidden'] = ''; |
373 | | - } else { |
| 363 | + if ( isset( $prop['archivename'] ) && $file->isOld() ) { |
374 | 364 | $vals['archivename'] = $file->getArchiveName(); |
375 | 365 | } |
376 | | - } |
377 | 366 | |
378 | | - if ( isset( $prop['bitdepth'] ) ) { |
379 | | - if ( $file->isDeleted( File::DELETED_FILE ) ) { |
380 | | - $vals['filehidden'] = ''; |
381 | | - } else { |
382 | | - $vals['bitdepth'] = $file->getBitDepth(); |
| 367 | + if ( isset( $prop['bitdepth'] ) ) { |
| 368 | + $vals['bitdepth'] = $file->getBitDepth(); |
383 | 369 | } |
384 | 370 | } |
385 | 371 | |