Merge "Ignore errors in RedisConnectionPool destructor"
[lhc/web/wiklou.git] / includes / media / MediaHandler.php
index ec4d372..2f72181 100644 (file)
@@ -85,7 +85,7 @@ abstract class MediaHandler {
         * Should be idempotent.
         * Returns false if the parameters are unacceptable and the transform should fail
         * @param File $image
-        * @param array $params
+        * @param array &$params
         */
        abstract function normaliseParams( $image, &$params );
 
@@ -157,7 +157,6 @@ abstract class MediaHandler {
         */
        function convertMetadataVersion( $metadata, $version = 1 ) {
                if ( !is_array( $metadata ) ) {
-
                        // unserialize to keep return parameter consistent.
                        MediaWiki\suppressWarnings();
                        $ret = unserialize( $metadata );
@@ -305,8 +304,10 @@ abstract class MediaHandler {
        }
 
        /**
-       * @deprecated since 1.30, use MediaHandler::getContentHeaders instead
-       */
+        * @deprecated since 1.30, use MediaHandler::getContentHeaders instead
+        * @param array $metadata
+        * @return array
+        */
        public function getStreamHeaders( $metadata ) {
                wfDeprecated( __METHOD__, '1.30' );
                return $this->getContentHeaders( $metadata );
@@ -713,7 +714,7 @@ abstract class MediaHandler {
         *
         * @see LocalFile::purgeThumbnails
         *
-        * @param array $files
+        * @param array &$files
         * @param array $options Purge options. Currently will always be
         *  an array with a single key 'forThumbRefresh' set to true.
         */
@@ -914,34 +915,12 @@ abstract class MediaHandler {
        }
 
        /**
-       * 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['width'] ) ) {
-                       if ( is_null( $fallbackWidth ) ) {
-                               return [];
-                       }
-
-                       $metadata['width'] = $fallbackWidth;
-               }
-
-               if ( !isset( $metadata['height'] ) ) {
-                       if ( is_null( $fallbackHeight ) ) {
-                               return [];
-                       }
-
-                       $metadata['height'] = $fallbackHeight;
-               }
-
-               $dimensionString = $metadata['width'] . 'x' . $metadata['height'];
-               $pagesByDimensions = [ $dimensionString => [ 1 ] ];
-               $pageRangesByDimensions = MediaHandler::getPageRangesByDimensions( $pagesByDimensions );
-
-               return [ 'X-Content-Dimensions' => $pageRangesByDimensions ];
+        * Get useful response headers for GET/HEAD requests for a file with the given metadata
+        * @param array $metadata Contains this handler's unserialized getMetadata() for a file
+        * @return array
+        * @since 1.30
+        */
+       public function getContentHeaders( $metadata ) {
+               return [];
        }
 }