[go: up one dir, main page]

Jump to content

Manual:Hooks/HtmlCacheUpdaterAppendUrls

From mediawiki.org
HtmlCacheUpdaterAppendUrls
Available from version 1.35.0 (Gerrit change 589421)
This hook is used to declare extra URLs to purge from HTTP caches.
Define function:
public static function onHtmlCacheUpdaterAppendUrls( Title $title, int $mode, array &$append ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"HtmlCacheUpdaterAppendUrls": "MediaWiki\\Extension\\MyExtension\\Hooks::onHtmlCacheUpdaterAppendUrls"
	}
}
Called from: File(s): cache/HtmlCacheUpdater.php
Function(s): getUrls
Interface: HtmlCacheUpdaterAppendUrlsHook.php

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


Use $mode to decide whether to gather all related URLs or only those affected by a re-render of the same content. For example, after a direct revision to the content the history page will need to be purged. However when re-rendering after a cascading change from a template, only URLs that render content need purging.

Parameters

[edit]
  • $title: Title of the page being updated
  • $mode: An int representing the mode. It will either HtmlCacheUpdater::PURGE_URLS_LINKSUPDATE_ONLY or 0.
  • &$append: Append URLs relating to the title