Umherirrender has uploaded a new change for review.
https://gerrit.wikimedia.org/r/186602
Change subject: Bypass TransformTooBigImageAreaError for ForeignApiFile
......................................................................
Bypass TransformTooBigImageAreaError for ForeignApiFile
The check if the image area is smaller than $wgMaxImageArea can be
bypassed for ForeignApiFile, because the transform of the file is done
on another physical server and therefore has it own check for
$wgMaxImageArea.
A possible TransformTooBigImageAreaError from the foreign server will be
shown when needed (Prepended by message 'thumbnail_error_remote').
Bug: T34387
Change-Id: Iccb25c00e132a4fe744840b7b8db7d9af620bce2
---
M includes/filerepo/file/File.php
M includes/filerepo/file/ForeignAPIFile.php
M includes/media/TransformationalImageHandler.php
3 files changed, 19 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/02/186602/1
diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php
index df85f9c..6dbd6a9 100644
--- a/includes/filerepo/file/File.php
+++ b/includes/filerepo/file/File.php
@@ -2206,4 +2206,13 @@
$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 isLocalTransform() {
+ return true;
+ }
}
diff --git a/includes/filerepo/file/ForeignAPIFile.php
b/includes/filerepo/file/ForeignAPIFile.php
index 3d5d5d6..ba89bb7 100644
--- a/includes/filerepo/file/ForeignAPIFile.php
+++ b/includes/filerepo/file/ForeignAPIFile.php
@@ -365,4 +365,13 @@
# 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 isLocalTransform() {
+ return false;
+ }
}
diff --git a/includes/media/TransformationalImageHandler.php
b/includes/media/TransformationalImageHandler.php
index fd8d81d..4abe8d6 100644
--- a/includes/media/TransformationalImageHandler.php
+++ b/includes/media/TransformationalImageHandler.php
@@ -167,7 +167,7 @@
return $this->getClientScalingThumbnailImage( $image,
$scalerParams );
}
- if ( !$this->isImageAreaOkForThumbnaling( $image, $params ) ) {
+ if ( $image->isLocalTransform() &&
!$this->isImageAreaOkForThumbnaling( $image, $params ) ) {
global $wgMaxImageArea;
return new TransformTooBigImageAreaError( $params,
$wgMaxImageArea );
}
--
To view, visit https://gerrit.wikimedia.org/r/186602
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iccb25c00e132a4fe744840b7b8db7d9af620bce2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits