Manual:Hooks/SetupAfterCache

Category:MediaWiki hooks#SetupAfterCache Category:Hooks added in MediaWiki 1.14.0#SetupAfterCache
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.phpCategory:MediaWiki hooks included in Setup.php#SetupAfterCache
Interface: SetupAfterCacheHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:SetupAfterCache extensions.

Usage

  • SetupAfterCache should only be used for any initialization that needs to run right after cache objects are set.
  • SetupAfterCache is not safe place for changing global configuration settings, because some services might have already been instantiated by the time this (or any) hook runs. The only safe place for manipulating configuration variables is an extension registration callback. The MediaWikiServices hook can be used as a stop-gap alternative for cases where a registration callback is not sufficient, but it is not entirely safe.
Category:Hooks added in MediaWiki 1.14.0 Category:MediaWiki hooks Category:MediaWiki hooks included in Setup.php