Manual:Hooks/SetupAfterCache

From mediawiki.org
Jump to navigation Jump to search
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": "MyExtensionHooks::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.


SetupAfterCache should only be used for initialization that actually needs to run right after $wgMemc stuff is created. Everything else should use $wgExtensionFunctions . If you need to use the RequestContext, consider the BeforeInitialize and ApiBeforeMain hooks instead.

Note that some services might have already been instantiated by the time this hook runs, so it's not generally a safe place for changing global configuration settings. While there is currently no dedicated hook for changing configuration, MediaWikiServices is safer than this one.