summaryrefslogtreecommitdiff
path: root/includes/MimeMagic.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-17 09:15:42 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-17 09:44:51 +0100
commita1789ddde42033f1b05cc4929491214ee6e79383 (patch)
tree63615735c4ddffaaabf2428946bb26f90899f7bf /includes/MimeMagic.php
parent9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff)
Update to MediaWiki 1.26.0
Diffstat (limited to 'includes/MimeMagic.php')
-rw-r--r--includes/MimeMagic.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php
index ebe98a3c..2b240c3b 100644
--- a/includes/MimeMagic.php
+++ b/includes/MimeMagic.php
@@ -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'];