r82820 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82819‎ | r82820 | r82821 >
Date:21:46, 25 February 2011
Author:reedy
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.17wmf1/RELEASE-NOTES (modified) (history)
  • /branches/wmf/1.17wmf1/includes/api/ApiQueryImageInfo.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/api/ApiQueryImageInfo.php
@@ -211,21 +211,33 @@
212212 */
213213 static function getInfo( $file, $prop, $result, $scale = null ) {
214214 $vals = array();
 215+ // Timestamp is shown even if the file is revdelete'd in interface
 216+ // so do same here.
215217 if ( isset( $prop['timestamp'] ) ) {
216218 $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $file->getTimestamp() );
217219 }
218 - if ( isset( $prop['user'] ) || isset( $prop['userid'] ) ) {
219220
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+ }
222237 }
223 - if ( isset( $prop['userid'] ) ) {
224 - $vals['userid'] = $file->getUser( 'id' );
225 - }
226 - if ( !$file->getUser( 'id' ) ) {
227 - $vals['anon'] = '';
228 - }
229238 }
 239+
 240+ // This is shown even if the file is revdelete'd in interface
 241+ // so do same here.
230242 if ( isset( $prop['size'] ) || isset( $prop['dimensions'] ) ) {
231243 $vals['size'] = intval( $file->getSize() );
232244 $vals['width'] = intval( $file->getWidth() );
@@ -236,9 +248,43 @@
237249 $vals['pagecount'] = $pageCount;
238250 }
239251 }
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 );
243289 if ( $mto && !$mto->isError() ) {
244290 $vals['thumburl'] = wfExpandUrl( $mto->getUrl() );
245291
@@ -256,36 +302,32 @@
257303 $thumbFile = UnregisteredLocalFile::newFromPath( $mto->getPath(), false );
258304 $vals['thumbmime'] = $thumbFile->getMimeType();
259305 }
 306+ } else if ( $mto && $mto->isError() ) {
 307+ $vals['thumberror'] = $mto->toText();
260308 }
261309 }
262310 $vals['url'] = $file->getFullURL();
263311 $vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl() );
264312 }
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 - }
273313
274 - if ( isset( $prop['sha1'] ) ) {
 314+ if ( $sha1 ) {
275315 $vals['sha1'] = wfBaseConvert( $file->getSha1(), 36, 16, 40 );
276316 }
277 - if ( isset( $prop['metadata'] ) ) {
 317+
 318+ if ( $meta ) {
278319 $metadata = $file->getMetadata();
279320 $vals['metadata'] = $metadata ? self::processMetaData( unserialize( $metadata ), $result ) : null;
280321 }
281 - if ( isset( $prop['mime'] ) ) {
 322+
 323+ if ( $mime ) {
282324 $vals['mime'] = $file->getMimeType();
283325 }
284326
285 - if ( isset( $prop['archivename'] ) && $file->isOld() ) {
 327+ if ( $archive && $file->isOld() ) {
286328 $vals['archivename'] = $file->getArchiveName();
287329 }
288330
289 - if ( isset( $prop['bitdepth'] ) ) {
 331+ if ( $bitdepth ) {
290332 $vals['bitdepth'] = $file->getBitDepth();
291333 }
292334
Property changes on: branches/wmf/1.17wmf1/includes/api/ApiQueryImageInfo.php
___________________________________________________________________
Modified: svn:mergeinfo
293335 Merged /trunk/phase3/includes/api/ApiQueryImageInfo.php:r82810,82813-82815,82818
Index: branches/wmf/1.17wmf1/RELEASE-NOTES
@@ -502,6 +502,7 @@
503503 * (bug 27201) Special:WhatLinksHere output no longer contains duplicate IDs
504504 * (bug 27479) API error when using both prop=pageprops and
505505 prop=info&inprop=displaytitle
 506+* (bug 27715) imageinfo didn't respect revdelete
506507
507508 * (bug 22738) Allow filtering by action type on query=logevent.
508509 * (bug 22764) uselang parameter for action=parse.
Property changes on: branches/wmf/1.17wmf1/RELEASE-NOTES
___________________________________________________________________
Modified: svn:mergeinfo
509510 Merged /trunk/phase3/RELEASE-NOTES:r82810,82813-82815,82818

Follow-up revisions

RevisionCommit summaryAuthorDate
r829601.17wmf1: Attempting to fix botched merge in r82820catrope21:01, 28 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82810(bug 27715) Make imageinfo api module respect revDelete....bawolff19:51, 25 February 2011
r82813(follow-up r82810) Address Reedy's comments on irc.bawolff20:16, 25 February 2011
r82814One minor followup to r82810...reedy20:22, 25 February 2011
r82815Fix double indentingreedy20:24, 25 February 2011
r82818Followup r82810, r82813, r82814...reedy21:41, 25 February 2011

Status & tagging log