Add new hook LinksUpdateAfterInsert to LinksUpdate
authorbsitu <bsitu@wikimedia.org>
Mon, 31 Dec 2012 22:30:32 +0000 (14:30 -0800)
committerbsitu <bsitu@wikimedia.org>
Wed, 2 Jan 2013 20:50:59 +0000 (12:50 -0800)
This will allow extensions to do some work based on the links inserted

Change-Id: Ia522de65ff17e28c6a8cd9997cf6225100fefc9e

docs/hooks.txt
includes/LinksUpdate.php

index f1034a6..abf1b80 100644 (file)
@@ -1353,8 +1353,14 @@ $linkType: The external link type
 actual update
 &$linksUpdate: the LinksUpdate object
 
-'LinksUpdateComplete': At the end of LinksUpdate::doUpdate() when updating has
-completed
+'LinksUpdateAfterInsert': At the end of LinksUpdate::incrTableUpdate() after
+each link table insert.  For example, pagelinks, imagelinks, externallinks.
+$linksUpdate: LinksUpdate object
+$table: the table to insert links to
+$insertions: an arry of links to insert
+
+'LinksUpdateComplete': At the end of LinksUpdate::doUpdate() when updating,
+including delete and insert, has completed for all link tables
 &$linksUpdate: the LinksUpdate object
 
 'LinksUpdateConstructed': At the end of LinksUpdate() is contruction.
index 7ddf863..cfd7413 100644 (file)
@@ -342,6 +342,7 @@ class LinksUpdate extends SqlDataUpdate {
                }
                if ( count( $insertions ) ) {
                        $this->mDb->insert( $table, $insertions, __METHOD__, 'IGNORE' );
+                       wfRunHooks( 'LinksUpdateAfterInsert', array( $this, $table, $insertions ) );
                }
        }