Page MenuHomePhabricator
Paste P10258

(An Untitled Masterwork)
ActivePublic

Authored by matmarex on Jan 24 2020, 12:52 PM.
Tags
None
Referenced Files
F31532155: raw.txt
Jan 24 2020, 12:52 PM
Subscribers
$wgHooks['UploadVerifyUpload'][] = function ( $upload, $user, $props, $comment, $pageText, &$error ) {
if ( strpos( $pageText, 'test-error' ) !== false ) {
$error = [ 'custom-test-error' ];
}
};

Event Timeline

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;

}