Manual:Hooks/TitleSquidURLs

From MediaWiki.org
Jump to navigation Jump to search
TitleSquidURLs
Available from version 1.22.0 (Gerrit change 64290)
Allows adding to/modifying the list of URLs to purge when a title is purged
Define function:
public static function onTitleSquidURLs( Title $title, array &$urls ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"TitleSquidURLs": "MyExtensionHooks::onTitleSquidURLs"
	}
}

For MediaWiki ≤1.25:

$wgHooks['TitleSquidURLs'][] = 'MyExtensionHooks::onTitleSquidURLs';
Called from: File(s): Title.php

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

Details[edit]

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[edit]