Manual:Hooks/SetupAfterCache

From mediawiki.org
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.
  • 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.