X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FMimeMagic.php;h=8ab92b4c1e9091eaa1098333320ca72e8e64ed4b;hb=01c2b0a4255f90805bee878bdd0432e5e3733d57;hp=ebe98a3c1dc1cd4610a4212c92393bafa5195561;hpb=958167760104b037db7db0a3c64e248052217759;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index ebe98a3c1d..8ab92b4c1e 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -323,7 +323,7 @@ class MimeMagic { continue; } - #print "processing MIME INFO line $s
"; + # print "processing MIME INFO line $s
"; $match = array(); if ( preg_match( '!\[\s*(\w+)\s*\]!', $s, $match ) ) { @@ -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'; @@ -693,7 +695,7 @@ class MimeMagic { } /* Look for WebP */ - if ( strncmp( $head, "RIFF", 4 ) == 0 && strncmp( substr( $head, 8, 8 ), "WEBPVP8 ", 8 ) == 0 ) { + if ( strncmp( $head, "RIFF", 4 ) == 0 && strncmp( substr( $head, 8, 7 ), "WEBPVP8", 7 ) == 0 ) { wfDebug( __METHOD__ . ": recognized file as image/webp\n" ); return "image/webp"; } @@ -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']; @@ -955,7 +957,7 @@ class MimeMagic { if ( $m ) { # normalize - $m = preg_replace( '![;, ].*$!', '', $m ); #strip charset, etc + $m = preg_replace( '![;, ].*$!', '', $m ); # strip charset, etc $m = trim( $m ); $m = strtolower( $m );