From: Aaron Schulz Date: Sun, 10 May 2015 19:49:43 +0000 (-0700) Subject: Set isExpensiveToThumbnail for the djvu handler X-Git-Tag: 1.31.0-rc.0~11455 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=63df71ea72a17c56cd1c929109324d7f631fdf6d;p=lhc%2Fweb%2Fwiklou.git 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 --- 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