Semantic MediaWiki and related extensions
|
The HookDispatcher
is provided to inject a hook event handler into a class that triggers a specific hook event with the objective to isolate the MediaWiki Hooks::run
static caller from a class instance.
The removal of the Hooks::run
static caller from an individual class follows mainly the problem of leaking global state into an instance which would persist during testing and hereby may alter results in a manner unpredictable based on hooks enabled at the time of the test run.
Extend the HookDispatcher
class with a particular method that is considered the public interface to trigger a hook event.
The HookDispatcherAwareTrait
has been introduced to help extend a class that is expected to trigger a specific hook event.
It requires to inject the HookDispatcher
upon creation of an instance of that class (which should be done using a factory) hereby removes global state that would otherwise be leaking into the instance via Hooks::run
.
A list of https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/technical/hooks.md "hook events" provided by Semantic MediaWiki to help users to extend its core functionality.