Manual:Hooks/MimeMagicInit

From MediaWiki.org
Jump to navigation Jump to search
MimeMagicInit
Available from version 1.24.0 (Gerrit change 141240)
Before processing the list mapping MIME types to media types and the list mapping MIME types to file extensions. As an extension author, you are encouraged to submit patches to MediaWiki's core to add new MIME types to mime.types.
Define function:
public static function onMimeMagicInit( $mimeAnalyzer ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"MimeMagicInit": "MyExtensionHooks::onMimeMagicInit"
	}
}

For MediaWiki ≤1.25:

$wgHooks['MimeMagicInit'][] = 'MyExtensionHooks::onMimeMagicInit';
Called from:File(s): ServiceWiring.php
Function(s): MimeAnalyzer::initCallback

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

Details[edit]

$mimeMagic
Instance of MimeMagic
  • Use $mimeMagic->addExtraInfo( $stringOfInfo ); for adding new MIME info to the list. Follow the pattern used in mime.info.
  • Use $mimeMagic->addExtraTypes( $stringOfTypes ); for adding new MIME types to the list. Follow the pattern used in mime.types.