Index: trunk/phase3/includes/MimeMagic.php |
— | — | @@ -430,7 +430,8 @@ |
431 | 431 | function improveTypeFromExtension( $mime, $ext ) { |
432 | 432 | if ( $mime === "unknown/unknown" ) { |
433 | 433 | if( $this->isRecognizableExtension( $ext ) ) { |
434 | | - wfDebug( __METHOD__. ": refusing to guess mime type for .$ext file, we should have recognized it\n" ); |
| 434 | + wfDebug( __METHOD__. ": refusing to guess mime type for .$ext file, " . |
| 435 | + "we should have recognized it\n" ); |
435 | 436 | } else { |
436 | 437 | /* Not something we can detect, so simply |
437 | 438 | * trust the file extension */ |
— | — | @@ -443,7 +444,8 @@ |
444 | 445 | * find the proper mime type for that file extension */ |
445 | 446 | $mime = $this->guessTypesForExtension( $ext ); |
446 | 447 | } else { |
447 | | - wfDebug( __METHOD__. ": refusing to guess better type for $mime file, .$ext is not a known OPC extension.\n" ); |
| 448 | + wfDebug( __METHOD__. ": refusing to guess better type for $mime file, " . |
| 449 | + ".$ext is not a known OPC extension.\n" ); |
448 | 450 | $mime = "application/zip"; |
449 | 451 | } |
450 | 452 | } |
— | — | @@ -470,7 +472,8 @@ |
471 | 473 | */ |
472 | 474 | function guessMimeType( $file, $ext = true ) { |
473 | 475 | if( $ext ) { # TODO: make $ext default to false. Or better, remove it. |
474 | | - wfDebug( __METHOD__.": WARNING: use of the \$ext parameter is deprecated. Use improveTypeFromExtension(\$mime, \$ext) instead.\n" ); |
| 476 | + wfDebug( __METHOD__.": WARNING: use of the \$ext parameter is deprecated. " . |
| 477 | + "Use improveTypeFromExtension(\$mime, \$ext) instead.\n" ); |
475 | 478 | } |
476 | 479 | |
477 | 480 | $mime = $this->doGuessMimeType( $file, $ext ); |
— | — | @@ -663,7 +666,8 @@ |
664 | 667 | */ |
665 | 668 | function detectZipType( $header, $tail = null, $ext = false ) { |
666 | 669 | if( $ext ) { # TODO: remove $ext param |
667 | | - wfDebug( __METHOD__.": WARNING: use of the \$ext parameter is deprecated. Use improveTypeFromExtension(\$mime, \$ext) instead.\n" ); |
| 670 | + wfDebug( __METHOD__.": WARNING: use of the \$ext parameter is deprecated. " . |
| 671 | + "Use improveTypeFromExtension(\$mime, \$ext) instead.\n" ); |
668 | 672 | } |
669 | 673 | |
670 | 674 | $mime = 'application/zip'; |
Index: trunk/phase3/includes/filerepo/File.php |
— | — | @@ -1197,8 +1197,10 @@ |
1198 | 1198 | $ext = strtolower( $i ? substr( $path, $i + 1 ) : '' ); |
1199 | 1199 | } |
1200 | 1200 | |
1201 | | - $info['file-mime'] = $magic->guessMimeType( $path, false ); # mime type according to file contents |
1202 | | - $info['mime'] = $magic->improveTypeFromExtension( $info['file-mime'], $ext ); # logical mime type |
| 1201 | + # mime type according to file contents |
| 1202 | + $info['file-mime'] = $magic->guessMimeType( $path, false ); |
| 1203 | + # logical mime type |
| 1204 | + $info['mime'] = $magic->improveTypeFromExtension( $info['file-mime'], $ext ); |
1203 | 1205 | |
1204 | 1206 | list( $info['major_mime'], $info['minor_mime'] ) = self::splitMime( $info['mime'] ); |
1205 | 1207 | $info['media_type'] = $magic->getMediaType( $path, $info['mime'] ); |