Manual:Hooks/LinksUpdateAfterInsert
From Linux Web Expert
File:OOjs UI icon alert-destructive.svg | <translate> This feature was removed completely in version <tvar name=ver>1.40.0</tvar> (after being deprecated in <tvar name=4>1.38.0</tvar>).</translate> |
LinksUpdateAfterInsert | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 41810)</tvar></translate> <translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 860937)</tvar></translate> Occurs right after new links have been inserted into the links table | |
<translate> Define function:</translate> | public static function onLinksUpdateAfterInsert( $linksUpdate, $table, $insertions ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"LinksUpdateAfterInsert": "MediaWiki\\Extension\\MyExtension\\Hooks::onLinksUpdateAfterInsert"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> LinksUpdate.php <translate> Function(s):</translate> LinksUpdate::incrTableUpdate() |
<translate> Interface:</translate> | LinksUpdateAfterInsertHook.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:LinksUpdateAfterInsert extensions</tvar>.</translate>
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 ) {