Manual:Hooks/SetupAfterCache
Appearance
SetupAfterCache | |
---|---|
Available from version 1.14.0 Called in Setup.php, after cache objects are set | |
Define function: | public static function onSetupAfterCache( ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"SetupAfterCache": "MediaWiki\\Extension\\MyExtension\\Hooks::onSetupAfterCache"
}
}
|
Called from: | File(s): Setup.php |
Interface: | SetupAfterCacheHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:SetupAfterCache extensions.
Usage
[edit]- SetupAfterCache should only be used for any initialization that needs to run right after cache objects are set.
- If you need to use the RequestContext , consider the BeforeInitialize and ApiBeforeMain hooks instead.
- Callback functions to be called further down the road after most initialisations are complete can be stored in the
$wgExtensionFunctions
variable.
- In practice, this hook is typically by extensions to register additional configuration settings and globals.
- It is not generally a safe place for changing global configuration settings because some services might have already been instantiated by the time this hook runs. While there is currently no dedicated hook for changing configuration, MediaWikiServices is safer than this one.