X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMimeMagic.php;h=3b065255a44327c4c4b710489382d2eceb02715f;hb=cdf39f956a8cf77fb546ae6d947c1c8969d1c2c5;hp=340683144404babbd8815fdd7381400d2fd63d26;hpb=2dfacba930072ec1b30c92c909c1848d13ff1e22;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index 3406831444..3b065255a4 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -200,7 +200,7 @@ class MimeMagic { global $IP; # Allow media handling extensions adding MIME-types and MIME-info - wfRunHooks( 'MimeMagicInit', array( $this ) ); + Hooks::run( 'MimeMagicInit', array( $this ) ); $types = MM_WELL_KNOWN_MIME_TYPES; @@ -218,7 +218,7 @@ class MimeMagic { wfDebug( __METHOD__ . ": can't load mime types from $mimeTypeFile\n" ); } } else { - wfDebug( __METHOD__ . ": no mime types file defined, using build-ins only.\n" ); + wfDebug( __METHOD__ . ": no mime types file defined, using built-ins only.\n" ); } $types .= "\n" . $this->mExtraTypes; @@ -295,7 +295,7 @@ class MimeMagic { wfDebug( __METHOD__ . ": can't load mime info from $mimeInfoFile\n" ); } } else { - wfDebug( __METHOD__ . ": no mime info file defined, using build-ins only.\n" ); + wfDebug( __METHOD__ . ": no mime info file defined, using built-ins only.\n" ); } $info .= "\n" . $this->mExtraInfo; @@ -569,7 +569,7 @@ class MimeMagic { } # Media handling extensions can improve the MIME detected - wfRunHooks( 'MimeMagicImproveFromExtension', array( $this, $ext, &$mime ) ); + Hooks::run( 'MimeMagicImproveFromExtension', array( $this, $ext, &$mime ) ); if ( isset( $this->mMimeTypeAliases[$mime] ) ) { $mime = $this->mMimeTypeAliases[$mime]; @@ -617,16 +617,18 @@ class MimeMagic { /** * Guess the MIME type from the file contents. * + * @todo Remove $ext param + * * @param string $file * @param mixed $ext * @return bool|string * @throws MWException */ - private function doGuessMimeType( $file, $ext ) { // TODO: remove $ext param + private function doGuessMimeType( $file, $ext ) { // Read a chunk of the file - wfSuppressWarnings(); + MediaWiki\suppressWarnings(); $f = fopen( $file, 'rb' ); - wfRestoreWarnings(); + MediaWiki\restoreWarnings(); if ( !$f ) { return 'unknown/unknown'; @@ -780,9 +782,9 @@ class MimeMagic { return $this->detectZipType( $head, $tail, $ext ); } - wfSuppressWarnings(); + MediaWiki\suppressWarnings(); $gis = getimagesize( $file ); - wfRestoreWarnings(); + MediaWiki\restoreWarnings(); if ( $gis && isset( $gis['mime'] ) ) { $mime = $gis['mime']; @@ -802,7 +804,7 @@ class MimeMagic { # people will hopefully nag and submit patches :) $mime = false; # Some strings by reference for performance - assuming well-behaved hooks - wfRunHooks( + Hooks::run( 'MimeMagicGuessFromContent', array( $this, &$head, &$tail, $file, &$mime ) );