Manual:Hooks/LinksUpdate

From Linux Web Expert

LinksUpdate
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
At the beginning of LinksUpdate::doUpdate() just before the actual update
<translate> Define function:</translate>
public static function onLinksUpdate( &$linksUpdate ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"LinksUpdate": "MediaWiki\\Extension\\MyExtension\\Hooks::onLinksUpdate"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> deferred/LinksUpdate/LinksUpdate.php
<translate> Function(s):</translate> MediaWiki\Deferred\LinksUpdate\LinksUpdate::doUpdate()
<translate> Interface:</translate> LinksUpdateHook.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:LinksUpdate extensions</tvar>.</translate>

Details

  • &$linksUpdate: the LinksUpdate object

LinksUpdate is called when a page has new content that needs to be processed for links (or, more generally, metadata), whether it got created, edited or restored. When a page is moved, the hook is called for both the old and new version of the page [1].

See also