Manual:Hooks/TitleSquidURLs

From Linux Web Expert

Revision as of 04:09, 4 March 2021 by imported>Baris6161TURK
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

TitleSquidURLs
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 64290)</tvar></translate>
Allows adding to/modifying the list of URLs to purge when a title is purged
<translate> Define function:</translate>
public static function onTitleSquidURLs( Title $title, array &$urls ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"TitleSquidURLs": "MediaWiki\\Extension\\MyExtension\\Hooks::onTitleSquidURLs"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> Title.php
<translate> Interface:</translate> TitleSquidURLsHook.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:TitleSquidURLs extensions</tvar>.</translate>


Details

This provides more fine-grained control over purging of pages cached by an HTTP accelerator such Varnish or Squid. Normally, when the cache is purged, the internal URL is purged ($title->getInternalURL()), as well as the action=history variant of that. This allows a hook listener to change (usually, add to), the list of affected URLs, if additional URLs depend on the content of a title.

See also