Handle EditFilterMergedContent hook properly to break hook chains and display error message

Extensions are supposed to return false to break hook chains when failed, which can avoid unnecessary call of later handlers in other extensions and work around with problems caused by difference betwen multiple triggers.

On mediawiki version 1.36 and before, just returning false in this hook can't display error message by default.
Set $status->value manually still to provide backward compatibility.

Bug: T280312
Change-Id: I456a40ce676c486b4ae12f00a7024a4c070448cd
This commit is contained in:
Func 2021-04-17 10:00:39 +00:00
parent 32ea1e7596
commit d4dd5a9408

View file

@ -61,9 +61,11 @@ class SpamBlacklistHooks implements
] ]
); );
$status->fatal( $error ); $status->fatal( $error );
// @todo Remove this line after this extension do not support mediawiki version 1.36 and before
$status->value = EditPage::AS_HOOK_ERROR_EXPECTED;
return false;
} }
// Always return true, EditPage will look at $status->isOk().
return true; return true;
} }