Manual:Hooks/MimeMagicImproveFromExtension

From MediaWiki.org
Jump to navigation Jump to search
MimeMagicImproveFromExtension
Available from version 1.24.0 (Gerrit change 141240)
Allows MW extensions to further improve the MIME type detected by considering the file extension.
Define function:
public static function onMimeMagicImproveFromExtension( $mimeAnalyzer, $ext, &$mime ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"MimeMagicImproveFromExtension": "MyExtensionHooks::onMimeMagicImproveFromExtension"
	}
}

For MediaWiki ≤1.25:

$wgHooks['MimeMagicImproveFromExtension'][] = 'MyExtensionHooks::onMimeMagicImproveFromExtension';
Called from:File(s): ServiceWiring.php
Function(s): MimeAnalyzer::extCallback

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:MimeMagicImproveFromExtension extensions.

Details[edit]

$mimeMagic
Instance of MimeMagic.
$ext
File extension.
&$mime
MIME type (in/out).