Manual:Hooks/MimeMagicInit
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( $mime ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"MimeMagicInit": "MediaWiki\\Extension\\MyExtension\\Hooks::onMimeMagicInit"
}
}
|
Called from: | File(s): ServiceWiring.php Function(s): MimeAnalyzer::initCallback |
Interface: | MimeMagicInitHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:MimeMagicInit extensions.
Details
edit$mime: Instance of MimeAnalyzer; $mime->addExtraTypes( 'application/xml svg' );
- Use
$mime->addExtraInfo( $stringOfInfo );
to add new MIME info to the list. - Use
$mime->addExtraTypes( $stringOfTypes );
to add new MIME types to the list.
See also
edit- Manual:MIME type detection, example of using this hook to add recognition of more file file extensions.
$wgFileExtensions
, control which file extensions may be used during upload.
- Built-in mime info and media types: MimeMap.php.