$wgHooks['UploadVerifyUpload'][] = function ( $upload, $user, $props, $comment, $pageText, &$error ) { | |
if ( strpos( $pageText, 'test-error' ) !== false ) { | |
$error = [ 'custom-test-error' ]; | |
} | |
}; |
Event Timeline
Comment Actions
ok i used a different hook; see below;
thank you for testing this for me! using the same code in your hook works; so it seems to pass through different code or so. i thought the hook you used wouldn't be called at all in the VisualEditor scenario. I didn't test very thoroughly i guess.
public static function onUploadVerifyFile( $upload, $mime, &$error ) { $statusForApi = Status::newGood(); $message = ApiMessage::create( 'my-message ); //defined in my-extension/i18n/en.json $statusForApi->error( $message ); $error=$message; }