Manual:Hooks/GetCacheVaryCookies

From MediaWiki.org
Jump to navigation Jump to search
GetCacheVaryCookies
Available from version 1.13.0
Get cookies that should vary cache options
Define function:
public static function onGetCacheVaryCookies( $out, &$cookies ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"GetCacheVaryCookies": "MyExtensionHooks::onGetCacheVaryCookies"
	}
}

For MediaWiki ≤1.25:

$wgHooks['GetCacheVaryCookies'][] = 'MyExtensionHooks::onGetCacheVaryCookies';
Called from:File(s): OutputPage.php

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

Details[edit]

  • $out: OutputPage object
  • &$cookies: array of cookies name, add a value to it if you want to add a cookie that have to vary cache options