| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Hook; |
| 4 | |
| 5 | use UploadBase; |
| 6 | use Wikimedia\Message\MessageSpecifier; |
| 7 | |
| 8 | /** |
| 9 | * This is a hook handler interface, see docs/Hooks.md. |
| 10 | * Use the hook name "UploadVerifyFile" to register handlers implementing this interface. |
| 11 | * |
| 12 | * @stable to implement |
| 13 | * @ingroup Hooks |
| 14 | */ |
| 15 | interface UploadVerifyFileHook { |
| 16 | /** |
| 17 | * Use this hook to perform extra file verification, based on MIME type, etc. |
| 18 | * |
| 19 | * @since 1.35 |
| 20 | * |
| 21 | * @param UploadBase $upload Instance of UploadBase, with all info about the upload |
| 22 | * @param string $mime Uploaded file's MIME type, as detected by MediaWiki. |
| 23 | * Handlers will typically only apply for specific MIME types. |
| 24 | * @param bool|array|MessageSpecifier &$error Output: true if the file is valid. |
| 25 | * Otherwise, set this to the reason in the form of [ messagename, param1, param2, ... ] |
| 26 | * or a MessageSpecifier instance. (You might want to use ApiMessage to provide machine |
| 27 | * -readable details for the API.) |
| 28 | * @return bool|void True or no return value to continue or false to abort |
| 29 | */ |
| 30 | public function onUploadVerifyFile( $upload, $mime, &$error ); |
| 31 | } |