Manual:Hooks/LinksUpdateAfterInsert

Category:MediaWiki hooks#LinksUpdateAfterInsert Category:Hooks added in MediaWiki 1.21.0#LinksUpdateAfterInsert Category:MediaWiki deprecated or obsolete features#LinksUpdateAfterInsert Category:Hooks removed in MediaWiki 1.40.0#LinksUpdateAfterInsert Category:Hooks deprecated in MediaWiki 1.38.0#LinksUpdateAfterInsert
LinksUpdateAfterInsert
Available from version 1.21.0 (Gerrit change 41810)
Removed in version 1.40.0 (Gerrit change 860937)Category:Removed hooks#LinksUpdateAfterInsert
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onLinksUpdateAfterInsert"
	}
}
Called from: File(s): LinksUpdate.phpCategory:MediaWiki hooks included in LinksUpdate.php#LinksUpdateAfterInsert
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.

Details

  • $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.

Notes

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 handler

/**
 * 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 also

Category:Hooks added in MediaWiki 1.21.0 Category:Hooks deprecated in MediaWiki 1.38.0 Category:Hooks removed in MediaWiki 1.40.0 Category:MediaWiki deprecated or obsolete features Category:MediaWiki hooks Category:MediaWiki hooks included in LinksUpdate.php Category:Removed hooks