| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Hook; |
| 4 | |
| 5 | use Wikimedia\Mime\MimeAnalyzer; |
| 6 | |
| 7 | /** |
| 8 | * This is a hook handler interface, see docs/Hooks.md. |
| 9 | * Use the hook name "MimeMagicGuessFromContent" to register handlers implementing this interface. |
| 10 | * |
| 11 | * @stable to implement |
| 12 | * @ingroup Hooks |
| 13 | */ |
| 14 | interface MimeMagicGuessFromContentHook { |
| 15 | /** |
| 16 | * Use this hook to guess the MIME by content. |
| 17 | * |
| 18 | * @since 1.35 |
| 19 | * |
| 20 | * @param MimeAnalyzer $mimeMagic |
| 21 | * @param string &$head First 1024 bytes of the file in a string (in - Do not alter!) |
| 22 | * @param string &$tail More or equal than last 65558 bytes of the file in a string |
| 23 | * (in - Do not alter!) |
| 24 | * @param string $file File path |
| 25 | * @param string &$mime MIME type (out) |
| 26 | * @return bool|void True or no return value to continue or false to abort |
| 27 | */ |
| 28 | public function onMimeMagicGuessFromContent( $mimeMagic, &$head, &$tail, $file, |
| 29 | &$mime |
| 30 | ); |
| 31 | } |