r72889 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72888‎ | r72889 | r72890 >
Date:03:10, 13 September 2010
Author:tstarling
Status:ok
Tags:
Comment:
Fixed some overly-long lines, mostly from r72023.
Modified paths:
  • /trunk/phase3/includes/MimeMagic.php (modified) (history)
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/MimeMagic.php
@@ -430,7 +430,8 @@
431431 function improveTypeFromExtension( $mime, $ext ) {
432432 if ( $mime === "unknown/unknown" ) {
433433 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" );
435436 } else {
436437 /* Not something we can detect, so simply
437438 * trust the file extension */
@@ -443,7 +444,8 @@
444445 * find the proper mime type for that file extension */
445446 $mime = $this->guessTypesForExtension( $ext );
446447 } 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" );
448450 $mime = "application/zip";
449451 }
450452 }
@@ -470,7 +472,8 @@
471473 */
472474 function guessMimeType( $file, $ext = true ) {
473475 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" );
475478 }
476479
477480 $mime = $this->doGuessMimeType( $file, $ext );
@@ -663,7 +666,8 @@
664667 */
665668 function detectZipType( $header, $tail = null, $ext = false ) {
666669 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" );
668672 }
669673
670674 $mime = 'application/zip';
Index: trunk/phase3/includes/filerepo/File.php
@@ -1197,8 +1197,10 @@
11981198 $ext = strtolower( $i ? substr( $path, $i + 1 ) : '' );
11991199 }
12001200
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 );
12031205
12041206 list( $info['major_mime'], $info['minor_mime'] ) = self::splitMime( $info['mime'] );
12051207 $info['media_type'] = $magic->getMediaType( $path, $info['mime'] );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r72023Follow-up to r71944: Interoducing MimeMagic::improveTypeFromExtension() for t...daniel13:47, 31 August 2010

Status & tagging log