Update suppressWarning()/restoreWarning() calls
[lhc/web/wiklou.git] / includes / media / DjVu.php
index f260850..2541e35 100644 (file)
@@ -265,9 +265,9 @@ class DjVuHandler extends ImageHandler {
                        return $metadata;
                }
 
-               MediaWiki\suppressWarnings();
+               Wikimedia\suppressWarnings();
                $unser = unserialize( $metadata );
-               MediaWiki\restoreWarnings();
+               Wikimedia\restoreWarnings();
                if ( is_array( $unser ) ) {
                        if ( isset( $unser['error'] ) ) {
                                return false;
@@ -321,7 +321,7 @@ class DjVuHandler extends ImageHandler {
         * @return array
         */
        protected function extractTreesFromMetadata( $metadata ) {
-               MediaWiki\suppressWarnings();
+               Wikimedia\suppressWarnings();
                try {
                        // Set to false rather than null to avoid further attempts
                        $metaTree = false;
@@ -344,7 +344,7 @@ class DjVuHandler extends ImageHandler {
                } catch ( Exception $e ) {
                        wfDebug( "Bogus multipage XML metadata\n" );
                }
-               MediaWiki\restoreWarnings();
+               Wikimedia\restoreWarnings();
 
                return [ 'MetaTree' => $metaTree, 'TextTree' => $textTree ];
        }
@@ -357,7 +357,7 @@ class DjVuHandler extends ImageHandler {
                global $wgDjvuOutputExtension;
                static $mime;
                if ( !isset( $mime ) ) {
-                       $magic = MimeMagic::singleton();
+                       $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
                        $mime = $magic->guessTypesForExtension( $wgDjvuOutputExtension );
                }
 
@@ -461,43 +461,4 @@ class DjVuHandler extends ImageHandler {
                        return false;
                }
        }
-
-       /**
-       * Get useful response headers for GET/HEAD requests for a file with the given metadata
-       * @param $metadata Array Contains this handler's unserialized getMetadata() for a file
-       * @param $fallbackWidth int|null Width to fall back to if metadata doesn't have any
-       * @param $fallbackHeight int|null Height to fall back to if metadata doesn't have any
-       * @return Array
-       * @since 1.30
-       */
-       public function getContentHeaders( $metadata, $fallbackWidth = null, $fallbackHeight = null ) {
-               if ( !isset( $metadata['xml'] ) ) {
-                       return [];
-               }
-
-               $trees = $this->extractTreesFromMetadata( $metadata['xml'] );
-               $dimensionInfo = $this->getDimensionInfoFromMetaTree( $trees['MetaTree'] );
-
-               if ( !$dimensionInfo ) {
-                       return [];
-               }
-
-               $pagesByDimensions = [];
-               $count = $dimensionInfo['pageCount'];
-
-               for ( $i = 1; $i <= $count; $i++ ) {
-                       $dimensions = $dimensionInfo['dimensionsByPage'][ $i - 1 ];
-                       $dimensionString = $dimensions['width'] . 'x' . $dimensions['height'];
-
-                       if ( isset ( $pagesByDimensions[ $dimensionString ] ) ) {
-                               $pagesByDimensions[ $dimensionString ][] = $i;
-                       } else {
-                               $pagesByDimensions[ $dimensionString ] = [ $i ];
-                       }
-               }
-
-               $pageRangesByDimensions = MediaHandler::getPageRangesByDimensions( $pagesByDimensions );
-
-               return [ 'X-Content-Dimensions' => $pageRangesByDimensions ];
-       }
 }