From 63df71ea72a17c56cd1c929109324d7f631fdf6d Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 10 May 2015 12:49:43 -0700 Subject: [PATCH] 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 --- includes/media/DjVu.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php index 011fb2a046..5b579523a5 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 */ @@ -49,6 +51,15 @@ class DjVuHandler extends ImageHandler { return true; } + /** + * 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 -- 2.20.1