Index: trunk/phase3/includes/api/ApiQueryImageInfo.php |
— | — | @@ -288,6 +288,7 @@ |
289 | 289 | } |
290 | 290 | } |
291 | 291 | } |
| 292 | + |
292 | 293 | // This is shown even if the file is revdelete'd in interface |
293 | 294 | // so do same here. |
294 | 295 | if ( isset( $prop['size'] ) || isset( $prop['dimensions'] ) ) { |
— | — | @@ -314,58 +315,60 @@ |
315 | 316 | } |
316 | 317 | } |
317 | 318 | |
318 | | - |
319 | 319 | if ( $file->isDeleted( File::DELETED_FILE ) ) { |
320 | 320 | $vals['filehidden'] = ''; |
321 | | - } else { |
322 | | - if ( isset( $prop['url'] ) ) { |
323 | | - if ( !is_null( $thumbParams ) ) { |
324 | | - $mto = $file->transform( $thumbParams ); |
325 | | - if ( $mto && !$mto->isError() ) { |
326 | | - $vals['thumburl'] = wfExpandUrl( $mto->getUrl() ); |
327 | 321 | |
328 | | - // bug 23834 - If the URL's are the same, we haven't resized it, so shouldn't give the wanted |
329 | | - // thumbnail sizes for the thumbnail actual size |
330 | | - if ( $mto->getUrl() !== $file->getUrl() ) { |
331 | | - $vals['thumbwidth'] = intval( $mto->getWidth() ); |
332 | | - $vals['thumbheight'] = intval( $mto->getHeight() ); |
333 | | - } else { |
334 | | - $vals['thumbwidth'] = intval( $file->getWidth() ); |
335 | | - $vals['thumbheight'] = intval( $file->getHeight() ); |
336 | | - } |
| 322 | + //Early return, tidier than indenting all following things one level |
| 323 | + return $vals; |
| 324 | + } |
337 | 325 | |
338 | | - if ( isset( $prop['thumbmime'] ) ) { |
339 | | - $thumbFile = UnregisteredLocalFile::newFromPath( $mto->getPath(), false ); |
340 | | - $vals['thumbmime'] = $thumbFile->getMimeType(); |
341 | | - } |
342 | | - } else if ( $mto && $mto->isError() ) { |
343 | | - $vals['thumberror'] = $mto->toText(); |
| 326 | + if ( isset( $prop['url'] ) ) { |
| 327 | + if ( !is_null( $thumbParams ) ) { |
| 328 | + $mto = $file->transform( $thumbParams ); |
| 329 | + if ( $mto && !$mto->isError() ) { |
| 330 | + $vals['thumburl'] = wfExpandUrl( $mto->getUrl() ); |
| 331 | + |
| 332 | + // bug 23834 - If the URL's are the same, we haven't resized it, so shouldn't give the wanted |
| 333 | + // thumbnail sizes for the thumbnail actual size |
| 334 | + if ( $mto->getUrl() !== $file->getUrl() ) { |
| 335 | + $vals['thumbwidth'] = intval( $mto->getWidth() ); |
| 336 | + $vals['thumbheight'] = intval( $mto->getHeight() ); |
| 337 | + } else { |
| 338 | + $vals['thumbwidth'] = intval( $file->getWidth() ); |
| 339 | + $vals['thumbheight'] = intval( $file->getHeight() ); |
344 | 340 | } |
| 341 | + |
| 342 | + if ( isset( $prop['thumbmime'] ) ) { |
| 343 | + $thumbFile = UnregisteredLocalFile::newFromPath( $mto->getPath(), false ); |
| 344 | + $vals['thumbmime'] = $thumbFile->getMimeType(); |
| 345 | + } |
| 346 | + } else if ( $mto && $mto->isError() ) { |
| 347 | + $vals['thumberror'] = $mto->toText(); |
345 | 348 | } |
346 | | - $vals['url'] = $file->getFullURL(); |
347 | | - $vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl() ); |
348 | 349 | } |
| 350 | + $vals['url'] = $file->getFullURL(); |
| 351 | + $vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl() ); |
| 352 | + } |
349 | 353 | |
350 | | - if ( isset( $prop['sha1'] ) ) { |
351 | | - $vals['sha1'] = wfBaseConvert( $file->getSha1(), 36, 16, 40 ); |
352 | | - } |
| 354 | + if ( isset( $prop['sha1'] ) ) { |
| 355 | + $vals['sha1'] = wfBaseConvert( $file->getSha1(), 36, 16, 40 ); |
| 356 | + } |
353 | 357 | |
354 | | - if ( isset( $prop['metadata'] ) ) { |
355 | | - $metadata = $file->getMetadata(); |
356 | | - $vals['metadata'] = $metadata ? self::processMetaData( unserialize( $metadata ), $result ) : null; |
357 | | - } |
| 358 | + if ( isset( $prop['metadata'] ) ) { |
| 359 | + $metadata = $file->getMetadata(); |
| 360 | + $vals['metadata'] = $metadata ? self::processMetaData( unserialize( $metadata ), $result ) : null; |
| 361 | + } |
358 | 362 | |
359 | | - if ( isset( $prop['mime'] ) ) { |
360 | | - $vals['mime'] = $file->getMimeType(); |
361 | | - } |
| 363 | + if ( isset( $prop['mime'] ) ) { |
| 364 | + $vals['mime'] = $file->getMimeType(); |
| 365 | + } |
362 | 366 | |
363 | | - if ( isset( $prop['archivename'] ) && $file->isOld() ) { |
364 | | - $vals['archivename'] = $file->getArchiveName(); |
365 | | - } |
| 367 | + if ( isset( $prop['archivename'] ) && $file->isOld() ) { |
| 368 | + $vals['archivename'] = $file->getArchiveName(); |
| 369 | + } |
366 | 370 | |
367 | | - if ( isset( $prop['bitdepth'] ) ) { |
368 | | - $vals['bitdepth'] = $file->getBitDepth(); |
369 | | - } |
| 371 | + if ( isset( $prop['bitdepth'] ) ) { |
| 372 | + $vals['bitdepth'] = $file->getBitDepth(); |
370 | 373 | } |
371 | 374 | |
372 | 375 | return $vals; |