Index: branches/REL1_17/phase3/includes/api/ApiQueryImageInfo.php |
— | — | @@ -211,21 +211,33 @@ |
212 | 212 | */ |
213 | 213 | static function getInfo( $file, $prop, $result, $scale = null ) { |
214 | 214 | $vals = array(); |
| 215 | + // Timestamp is shown even if the file is revdelete'd in interface |
| 216 | + // so do same here. |
215 | 217 | if ( isset( $prop['timestamp'] ) ) { |
216 | 218 | $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $file->getTimestamp() ); |
217 | 219 | } |
218 | | - if ( isset( $prop['user'] ) || isset( $prop['userid'] ) ) { |
219 | 220 | |
220 | | - if ( isset( $prop['user'] ) ) { |
221 | | - $vals['user'] = $file->getUser(); |
| 221 | + $user = isset( $prop['user'] ); |
| 222 | + $userid = isset( $prop['userid'] ); |
| 223 | + |
| 224 | + if ( $user || $userid ) { |
| 225 | + if ( $file->isDeleted( File::DELETED_USER ) ) { |
| 226 | + $vals['userhidden'] = ''; |
| 227 | + } else { |
| 228 | + if ( $user ) { |
| 229 | + $vals['user'] = $file->getUser(); |
| 230 | + } |
| 231 | + if ( $userid ) { |
| 232 | + $vals['userid'] = $file->getUser( 'id' ); |
| 233 | + } |
| 234 | + if ( !$file->getUser( 'id' ) ) { |
| 235 | + $vals['anon'] = ''; |
| 236 | + } |
222 | 237 | } |
223 | | - if ( isset( $prop['userid'] ) ) { |
224 | | - $vals['userid'] = $file->getUser( 'id' ); |
225 | | - } |
226 | | - if ( !$file->getUser( 'id' ) ) { |
227 | | - $vals['anon'] = ''; |
228 | | - } |
229 | 238 | } |
| 239 | + |
| 240 | + // This is shown even if the file is revdelete'd in interface |
| 241 | + // so do same here. |
230 | 242 | if ( isset( $prop['size'] ) || isset( $prop['dimensions'] ) ) { |
231 | 243 | $vals['size'] = intval( $file->getSize() ); |
232 | 244 | $vals['width'] = intval( $file->getWidth() ); |
— | — | @@ -236,9 +248,43 @@ |
237 | 249 | $vals['pagecount'] = $pageCount; |
238 | 250 | } |
239 | 251 | } |
240 | | - if ( isset( $prop['url'] ) ) { |
241 | | - if ( !is_null( $scale ) && !$file->isOld() ) { |
242 | | - $mto = $file->transform( array( 'width' => $scale['width'], 'height' => $scale['height'] ) ); |
| 252 | + |
| 253 | + $pcomment = isset( $prop['parsedcomment'] ); |
| 254 | + $comment = isset( $prop['comment'] ); |
| 255 | + |
| 256 | + if ( $pcomment || $comment ) { |
| 257 | + if ( $file->isDeleted( File::DELETED_COMMENT ) ) { |
| 258 | + $vals['commenthidden'] = ''; |
| 259 | + } else { |
| 260 | + if ( $pcomment ) { |
| 261 | + global $wgUser; |
| 262 | + $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( |
| 263 | + $file->getDescription(), $file->getTitle() ); |
| 264 | + } |
| 265 | + if ( $comment ) { |
| 266 | + $vals['comment'] = $file->getDescription(); |
| 267 | + } |
| 268 | + } |
| 269 | + } |
| 270 | + |
| 271 | + $url = isset( $prop['url'] ); |
| 272 | + $sha1 = isset( $prop['sha1'] ); |
| 273 | + $meta = isset( $prop['metadata'] ); |
| 274 | + $mime = isset( $prop['mime'] ); |
| 275 | + $archive = isset( $prop['archivename'] ); |
| 276 | + $bitdepth = isset( $prop['bitdepth'] ); |
| 277 | + |
| 278 | + if ( ( $url || $sha1 || $meta || $mime || $archive || $bitdepth ) |
| 279 | + && $file->isDeleted( File::DELETED_FILE ) ) { |
| 280 | + $vals['filehidden'] = ''; |
| 281 | + |
| 282 | + //Early return, tidier than indenting all following things one level |
| 283 | + return $vals; |
| 284 | + } |
| 285 | + |
| 286 | + if ( $url ) { |
| 287 | + if ( !is_null( $thumbParams ) ) { |
| 288 | + $mto = $file->transform( $thumbParams ); |
243 | 289 | if ( $mto && !$mto->isError() ) { |
244 | 290 | $vals['thumburl'] = wfExpandUrl( $mto->getUrl() ); |
245 | 291 | |
— | — | @@ -256,36 +302,32 @@ |
257 | 303 | $thumbFile = UnregisteredLocalFile::newFromPath( $mto->getPath(), false ); |
258 | 304 | $vals['thumbmime'] = $thumbFile->getMimeType(); |
259 | 305 | } |
| 306 | + } else if ( $mto && $mto->isError() ) { |
| 307 | + $vals['thumberror'] = $mto->toText(); |
260 | 308 | } |
261 | 309 | } |
262 | 310 | $vals['url'] = $file->getFullURL(); |
263 | 311 | $vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl() ); |
264 | 312 | } |
265 | | - if ( isset( $prop['comment'] ) ) { |
266 | | - $vals['comment'] = $file->getDescription(); |
267 | | - } |
268 | | - if ( isset( $prop['parsedcomment'] ) ) { |
269 | | - global $wgUser; |
270 | | - $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( |
271 | | - $file->getDescription(), $file->getTitle() ); |
272 | | - } |
273 | 313 | |
274 | | - if ( isset( $prop['sha1'] ) ) { |
| 314 | + if ( $sha1 ) { |
275 | 315 | $vals['sha1'] = wfBaseConvert( $file->getSha1(), 36, 16, 40 ); |
276 | 316 | } |
277 | | - if ( isset( $prop['metadata'] ) ) { |
| 317 | + |
| 318 | + if ( $meta ) { |
278 | 319 | $metadata = $file->getMetadata(); |
279 | 320 | $vals['metadata'] = $metadata ? self::processMetaData( unserialize( $metadata ), $result ) : null; |
280 | 321 | } |
281 | | - if ( isset( $prop['mime'] ) ) { |
| 322 | + |
| 323 | + if ( $mime ) { |
282 | 324 | $vals['mime'] = $file->getMimeType(); |
283 | 325 | } |
284 | 326 | |
285 | | - if ( isset( $prop['archivename'] ) && $file->isOld() ) { |
| 327 | + if ( $archive && $file->isOld() ) { |
286 | 328 | $vals['archivename'] = $file->getArchiveName(); |
287 | 329 | } |
288 | 330 | |
289 | | - if ( isset( $prop['bitdepth'] ) ) { |
| 331 | + if ( $bitdepth ) { |
290 | 332 | $vals['bitdepth'] = $file->getBitDepth(); |
291 | 333 | } |
292 | 334 | |
Property changes on: branches/REL1_17/phase3/includes/api/ApiQueryImageInfo.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
293 | 335 | Merged /trunk/phase3/includes/api/ApiQueryImageInfo.php:r82810,82813-82815,82818 |
Index: branches/REL1_17/phase3/RELEASE-NOTES |
— | — | @@ -502,6 +502,7 @@ |
503 | 503 | * action=parse now correctly returns an error for nonexistent pages |
504 | 504 | * (bug 27201) Special:WhatLinksHere output no longer contains duplicate IDs |
505 | 505 | * (bug 26560) On allusers if limit < total number of users, last user gets duplicate |
| 506 | +* (bug 27715) imageinfo didn't respect revdelete |
506 | 507 | |
507 | 508 | * (bug 22738) Allow filtering by action type on query=logevent. |
508 | 509 | * (bug 22764) uselang parameter for action=parse. |
Property changes on: branches/REL1_17/phase3/RELEASE-NOTES |
___________________________________________________________________ |
Modified: svn:mergeinfo |
509 | 510 | Merged /trunk/phase3/RELEASE-NOTES:r82810,82813-82815,82818 |