X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FMediaHandler.php;h=481e880cfe47fea3e232ce36b2fbd09feea49542;hb=a2c8c2969420a0f150c03f76e3a0bf9028fcda43;hp=76c979e0a42f4359ac45cafd6baefe9b18a3d1b2;hpb=97c5bc0a1ea20ed4f6c3e26b97dcd5d6f360a8ce;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php index 76c979e0a4..c76930cfc7 100644 --- a/includes/media/MediaHandler.php +++ b/includes/media/MediaHandler.php @@ -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 ); @@ -158,9 +158,9 @@ abstract class MediaHandler { function convertMetadataVersion( $metadata, $version = 1 ) { if ( !is_array( $metadata ) ) { // unserialize to keep return parameter consistent. - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $ret = unserialize( $metadata ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); return $ret; } @@ -255,7 +255,7 @@ abstract class MediaHandler { * Get a MediaTransformOutput object representing the transformed output. Does not * actually do the transform. * - * @param File $image The image object + * @param File $image * @param string $dstPath Filesystem destination path * @param string $dstUrl Destination URL to use in output HTML * @param array $params Arbitrary set of parameters validated by $this->validateParam() @@ -269,7 +269,7 @@ abstract class MediaHandler { * Get a MediaTransformOutput object representing the transformed output. Does the * transform unless $flags contains self::TRANSFORM_LATER. * - * @param File $image The image object + * @param File $image * @param string $dstPath Filesystem destination path * @param string $dstUrl Destination URL to use in output HTML * @param array $params Arbitrary set of parameters validated by $this->validateParam() @@ -288,7 +288,7 @@ abstract class MediaHandler { * @return array Thumbnail extension and MIME type */ function getThumbType( $ext, $mime, $params = null ) { - $magic = MimeMagic::singleton(); + $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer(); if ( !$ext || $magic->isMatchingExtension( $ext, $mime ) === false ) { // The extension is not valid for this MIME type and we do // recognize the MIME type @@ -304,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 ); @@ -495,7 +497,7 @@ abstract class MediaHandler { * * This is used by the media handlers that use the FormatMetadata class * - * @param array $metadataArray Metadata array + * @param array $metadataArray * @param bool|IContextSource $context Context to use (optional) * @return array Array for use displaying metadata. */ @@ -712,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. */ @@ -872,7 +874,7 @@ abstract class MediaHandler { * @param Array $pagesByDimensions * @return String * @since 1.30 - */ + */ public static function getPageRangesByDimensions( $pagesByDimensions ) { $pageRangesByDimensions = []; @@ -913,12 +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 - * @return Array - * @since 1.30 - */ + * 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 []; + return [ 'X-Content-Dimensions' => '' ]; // T175689 } }