Merge "Bypass TransformTooBigImageAreaError for ForeignApiFile"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 27 May 2015 16:47:54 +0000 (16:47 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 27 May 2015 16:47:54 +0000 (16:47 +0000)
includes/filerepo/file/File.php
includes/filerepo/file/ForeignAPIFile.php
includes/media/TransformationalImageHandler.php

index eb50a12..76ed27b 100644 (file)
@@ -2231,4 +2231,13 @@ abstract class File implements IDBAccessObject {
                $handler = $this->getHandler();
                return $handler ? $handler->isExpensiveToThumbnail( $this ) : false;
        }
+
+       /**
+        * Whether the thumbnails created on the same server as this code is running.
+        * @since 1.25
+        * @return bool
+        */
+       public function isTransformedLocally() {
+               return true;
+       }
 }
index e51f381..3c78290 100644 (file)
@@ -369,4 +369,13 @@ class ForeignAPIFile extends File {
                # Clear out the thumbnail directory if empty
                $this->repo->quickCleanDir( $dir );
        }
+
+       /**
+        * The thumbnail is created on the foreign server and fetched over internet
+        * @since 1.25
+        * @return bool
+        */
+       public function isTransformedLocally() {
+               return false;
+       }
 }
index fd8d81d..15753a9 100644 (file)
@@ -167,7 +167,7 @@ abstract class TransformationalImageHandler extends ImageHandler {
                        return $this->getClientScalingThumbnailImage( $image, $scalerParams );
                }
 
-               if ( !$this->isImageAreaOkForThumbnaling( $image, $params ) ) {
+               if ( $image->isTransformedLocally() && !$this->isImageAreaOkForThumbnaling( $image, $params ) ) {
                        global $wgMaxImageArea;
                        return new TransformTooBigImageAreaError( $params, $wgMaxImageArea );
                }