Last modified: 2014-09-24 01:27:32 UTC
There should be an option for sysadmin to put additional custom mime.types entries separated from the initial "includes/mime.types" file. Letting sysadmin to edit the file "includes/mime.types" is not a good idea, since it will decrease the maintainability, especially when upgrading the MediaWiki software. The custom mime.types entries should be placed in a separate file. The file name may be specified in a variable, $wgCustomMimeTypes, for example. This option is necessary, since the custom mime.types are still commonly needed, especially, openoffice document on redhat. Eventhough the openoffice mimetype has been added in Bug 17497 (https://bugzilla.wikimedia.org/show_bug.cgi?id=17497), however, the command "file -bi" on Redhat, still return application/x-zip for openoffice files.
Hmm, [[mediawikiwiki:Manual:$wgMimeTypeFile]] seems to do this task, but it not allow specifying multiple files.
[[mw:Manual:$wgMimeTypeFile]] [[mwwiki:Manual:$wgMimeTypeFile]] [[mediawiki:Manual:$wgMimeTypeFile]] http://www.mediawiki.org/wiki/Manual:$wgMimeTypeFile
It should allow specifying files in array like, $wgMimeTypeFile = array("includes/mime.types", "/etc/mime.types", "/path/to/custom/mime.types");
$wgCustomMimeTypes may be used to override some mime types like this, $wgCustomMimeTypes = "application/x-zip odt application/x-zip ods application/x-zip odp application/x-zip jar";
The code for comment #4, will look like this, includes/MimeMagic.php: $types = MM_WELL_KNOWN_MIME_TYPES; if ( $wgMimeTypeFile == 'includes/mime.types' ) { $wgMimeTypeFile = "$IP/$wgMimeTypeFile"; } if ( $wgMimeTypeFile ) { ... $types .= file_get_contents( $wgMimeTypeFile ); ... } else { ... } + if ($wgCustomMimeTypes != "") $types .= "\n" . $wgCustomMimeTypes; $types = str_replace( array( "\r\n", "\n\r", "\n\n", "\r\r", "\r" ), "\n", $types ); $types = str_replace( "\t", " ", $types );
(In reply to comment #3) > It should allow specifying files in array like, > > $wgMimeTypeFile = array("includes/mime.types", "/etc/mime.types", > "/path/to/custom/mime.types"); > Since "includes/mime.types" and "/etc/mime.types" contains many duplicate entries, it may result in unnecessary work load, so it should be discouraged to load multiple files like this.
I believe that with $wgMimeTypeFile we have sufficient customization possibility.
(In reply to comment #7) > I believe that with $wgMimeTypeFile we have sufficient customization > possibility. it is insufficient, since we may need to append the customization to the upstream default
Anon Sricharoenchai, I'm removing the "patch" keyword since you haven't attached a patch per https://www.mediawiki.org/wiki/Patch#Posting_a_patch . Please take a look at that page and consider contributing your fix as a patch against trunk. Thanks!