Manual:Hooks/LinksUpdateAfterInsert

LinksUpdateAfterInsert
Available from version 1.21.0 (Gerrit change 41810)
Occurs right after new links have been inserted into the links table
Define function:
public static function onLinksUpdateAfterInsert( $linksUpdate, $table, $insertions ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"LinksUpdateAfterInsert": "MyExtensionHooks::onLinksUpdateAfterInsert"
	}
}
Called from: File(s): LinksUpdate.php
Function(s): LinksUpdate::incrTableUpdate()
Interface: LinksUpdateAfterInsertHook.php

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


DetailsEdit

  • $linksUpdate: the LinksUpdate object calling the hook
  • $table: the name of the table that was just inserted into
  • $insertions: an array of the links that were inserted

The function should return true to continue hook processing or false to abort.

NotesEdit

It runs if $wgUseDumbLinkUpdate is false (meaning incremental updates were done), and at least one link is inserted. It is called for all types of links, from LinksUpdate->incrTableUpdate, after both deletion then insertion are done.

Example handlerEdit

/**
 * Handler for LinksUpdateAfterInsert hook.
 * @see http://www.mediawiki.org/wiki/Manual:Hooks/LinksUpdateAfterInsert
 * @param $linksUpdate LinksUpdate
 * @param $table string
 * @param $insertions array
 * @return bool
 */
public static function onLinksUpdateAfterInsert( $linksUpdate, $table, $insertions ) {

See alsoEdit