Manual:Hooks/GetCacheVaryCookies

From Linux Web Expert

GetCacheVaryCookies
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
Get cookies that should vary cache options
<translate> Define function:</translate>
public static function onGetCacheVaryCookies( $out, &$cookies ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"GetCacheVaryCookies": "MediaWiki\\Extension\\MyExtension\\Hooks::onGetCacheVaryCookies"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> OutputPage.php
<translate> Interface:</translate> GetCacheVaryCookiesHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:GetCacheVaryCookies extensions</tvar>.</translate>

Details

  • $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