* (bug 27199) Thumbnail urls can be fetched for old files as well
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Fri, 11 Feb 2011 15:40:39 +0000 (15:40 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Fri, 11 Feb 2011 15:40:39 +0000 (15:40 +0000)
RELEASE-NOTES
includes/api/ApiQueryImageInfo.php

index 6716250..6b69b89 100644 (file)
@@ -168,6 +168,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 27205) aiprop=metadata and aiprop=parsedcomment need help text
 * Add a amtitle param to meta=allmessages
 * (bug 25832) query=allimages now outputs ns/title as well
+* (bug 27199) Thumbnail urls can be fetched for old files as well
 
 === Languages updated in 1.18 ===
 
index f742db4..0a8243d 100644 (file)
@@ -107,6 +107,9 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                        }
                                        break;
                                }
+                               
+                               // Check if we can make the requested thumbnail
+                               $this->validateThumbParams( $img, $thumbParams );
 
                                // Get information about the current version first
                                // Check that the current version is within the start-end boundaries
@@ -117,7 +120,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                )
                                {
                                        $gotOne = true;
-                                       $this->validateThumbParams( $img, $thumbParams );
+                                       
                                        $fit = $this->addPageSubItem( $pageId,
                                                self::getInfo( $img, $prop, $result, $thumbParams ) );
                                        if ( !$fit ) {
@@ -148,7 +151,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                                break;
                                        }
                                        $fit = $this->addPageSubItem( $pageId,
-                                               self::getInfo( $oldie, $prop, $result ) );
+                                               self::getInfo( $oldie, $prop, $result, $thumbParams ) );
                                        if ( !$fit ) {
                                                if ( count( $pageIds[NS_IMAGE] ) == 1 ) {
                                                        $this->setContinueEnumParameter( 'start',
@@ -301,7 +304,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                        }
                }
                if ( isset( $prop['url'] ) ) {
-                       if ( !is_null( $thumbParams ) && !$file->isOld() ) {
+                       if ( !is_null( $thumbParams ) ) {
                                $mto = $file->transform( $thumbParams );
                                if ( $mto && !$mto->isError() ) {
                                        $vals['thumburl'] = wfExpandUrl( $mto->getUrl() );
@@ -321,6 +324,10 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                                $vals['thumbmime'] = $thumbFile->getMimeType();
                                        }
                                }
+                               if ( $mto && $mto->isError() ) {
+                                       $this->setWarning( 'Error creating thumbnail for ' . $file->getName . 
+                                               ': ' . $mto->toText() );
+                               }
                        }
                        $vals['url'] = $file->getFullURL();
                        $vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl() );