r82813 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82812‎ | r82813 | r82814 >
Date:20:16, 25 February 2011
Author:bawolff
Status:ok (Comments)
Tags:
Comment:
(follow-up r82810) Address Reedy's comments on irc.
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryImageInfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryImageInfo.php
@@ -267,13 +267,16 @@
268268 */
269269 static function getInfo( $file, $prop, $result, $thumbParams = null ) {
270270 $vals = array();
 271+ // Timestamp is shown even if the file is revdelete'd in interface
 272+ // so do same here.
271273 if ( isset( $prop['timestamp'] ) ) {
272274 $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $file->getTimestamp() );
273275 }
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'] ) ) {
278281 if ( isset( $prop['user'] ) ) {
279282 $vals['user'] = $file->getUser();
280283 }
@@ -285,6 +288,8 @@
286289 }
287290 }
288291 }
 292+ // This is shown even if the file is revdelete'd in interface
 293+ // so do same here.
289294 if ( isset( $prop['size'] ) || isset( $prop['dimensions'] ) ) {
290295 $vals['size'] = intval( $file->getSize() );
291296 $vals['width'] = intval( $file->getWidth() );
@@ -295,10 +300,25 @@
296301 $vals['pagecount'] = $pageCount;
297302 }
298303 }
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'] ) ) {
303323 if ( !is_null( $thumbParams ) ) {
304324 $mto = $file->transform( $thumbParams );
305325 if ( $mto && !$mto->isError() ) {
@@ -325,60 +345,26 @@
326346 $vals['url'] = $file->getFullURL();
327347 $vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl() );
328348 }
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 - }
346349
347 - if ( isset( $prop['sha1'] ) ) {
348 - if ( $file->isDeleted( File::DELETED_FILE ) ) {
349 - $vals['filehidden'] = '';
350 - } else {
 350+ if ( isset( $prop['sha1'] ) ) {
351351 $vals['sha1'] = wfBaseConvert( $file->getSha1(), 36, 16, 40 );
352352 }
353 - }
354 - if ( isset( $prop['metadata'] ) ) {
355 - if ( $file->isDeleted( File::DELETED_FILE ) ) {
356 - $vals['filehidden'] = '';
357 - } else {
 353+
 354+ if ( isset( $prop['metadata'] ) ) {
358355 $metadata = $file->getMetadata();
359356 $vals['metadata'] = $metadata ? self::processMetaData( unserialize( $metadata ), $result ) : null;
360357 }
361 - }
362 - if ( isset( $prop['mime'] ) ) {
363 - if ( $file->isDeleted( File::DELETED_FILE ) ) {
364 - $vals['filehidden'] = '';
365 - } else {
 358+
 359+ if ( isset( $prop['mime'] ) ) {
366360 $vals['mime'] = $file->getMimeType();
367361 }
368 - }
369362
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() ) {
374364 $vals['archivename'] = $file->getArchiveName();
375365 }
376 - }
377366
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();
383369 }
384370 }
385371

Follow-up revisions

RevisionCommit summaryAuthorDate
r82818Followup r82810, r82813, r82814...reedy21:41, 25 February 2011
r82819MFT r82810, r82813, r82814, r82815, r82818reedy21:45, 25 February 2011
r82820MFT r82810, r82813, r82814, r82815, r82818reedy21:46, 25 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82810(bug 27715) Make imageinfo api module respect revDelete....bawolff19:51, 25 February 2011

Comments

#Comment by Duplicatebug (talk | contribs)   20:37, 25 February 2011

With this change the api adds always userhidden="" commenthidden="" filehidden="" when one of that is true. That differ from prop=revisions or list=logevents.

Status & tagging log