Don't load XML metadata on DjVu thumb generation
authorGabriel Wicke <gwicke@wikimedia.org>
Sat, 25 Apr 2015 20:03:20 +0000 (13:03 -0700)
committerGabriel Wicke <gwicke@wikimedia.org>
Sat, 25 Apr 2015 20:04:17 +0000 (13:04 -0700)
As described in T96360, scaling of DjVu files loads huge XML blobs from the
database for no apparent reason. This caused several outages by overloading
the database.

This patch simply removes the XML fetching & associated check.

Bug: T96360

Change-Id: I99d90b569bf9a6b6492ecca23b1b00267b0fa0ab

includes/media/DjVu.php

index 1b0eb49..5f6b965 100644 (file)
@@ -137,17 +137,6 @@ class DjVuHandler extends ImageHandler {
        function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
                global $wgDjvuRenderer, $wgDjvuPostProcessor;
 
-               // Fetch XML and check it, to give a more informative error message than the one which
-               // normaliseParams will inevitably give.
-               $xml = $image->getMetadata();
-               if ( !$xml ) {
-                       $width = isset( $params['width'] ) ? $params['width'] : 0;
-                       $height = isset( $params['height'] ) ? $params['height'] : 0;
-
-                       return new MediaTransformError( 'thumbnail_error', $width, $height,
-                               wfMessage( 'djvu_no_xml' )->text() );
-               }
-
                if ( !$this->normaliseParams( $image, $params ) ) {
                        return new TransformParameterError( $params );
                }