Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/209986

Change subject: Set isExpensiveToThumbnail for the djvu handler
......................................................................

Set isExpensiveToThumbnail for the djvu handler

* This makes FileRenderExpensive pool logic apply for large files
  to cut down on DB load from getMetaTree()

Bug: T96360
Change-Id: If892d77077607ffcaba0510355175a1e4d780ae9
---
M includes/media/DjVu.php
1 file changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/86/209986/1

diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php
index 011fb2a..5b57952 100644
--- a/includes/media/DjVu.php
+++ b/includes/media/DjVu.php
@@ -27,6 +27,8 @@
  * @ingroup Media
  */
 class DjVuHandler extends ImageHandler {
+       const EXPENSIVE_SIZE_LIMIT = 10485760; // 10MiB
+
        /**
         * @return bool
         */
@@ -50,6 +52,15 @@
        }
 
        /**
+        * True if creating thumbnails from the file is large or otherwise 
resource-intensive.
+        * @param File $file
+        * @return bool
+        */
+       public function isExpensiveToThumbnail( $file ) {
+               return $file->getSize() > static::EXPENSIVE_SIZE_LIMIT;
+       }
+
+       /**
         * @param File $file
         * @return bool
         */

-- 
To view, visit https://gerrit.wikimedia.org/r/209986
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If892d77077607ffcaba0510355175a1e4d780ae9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.26wmf4
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to