Add TitleMoveStarting, mirroring TitleMoveCompleting
authorMatthew Flaschen <mflaschen@wikimedia.org>
Wed, 24 Feb 2016 23:50:58 +0000 (18:50 -0500)
committerMatthew Flaschen <mflaschen@wikimedia.org>
Thu, 25 Feb 2016 18:31:04 +0000 (13:31 -0500)
This is a pre-requisite to fix a Flow move regression, T127785.

This allows running an atomic entirely within the move with the correct
ordering.

Bug: T127785
Change-Id: Ie772f737f917854e4cfefe52ec3bea4669c9efe0

docs/hooks.txt
includes/MovePage.php

index 930aa0a..8955f54 100644 (file)
@@ -3066,6 +3066,11 @@ $old: old title
 $nt: new title
 $user: user who does the move
 
+'TitleMoveStarting': Before moving an article (title), but just after the atomic DB section starts.
+$old: old title
+$nt: new title
+$user: user who does the move
+
 'TitleMoveComplete': After moving an article (title), post-commit.
 &$old: old title
 &$nt: new title
index 6d69eaa..afa4e1c 100644 (file)
@@ -248,6 +248,9 @@ class MovePage {
                }
 
                $dbw->startAtomic( __METHOD__ );
+
+               Hooks::run( 'TitleMoveStarting', [ $this->oldTitle, $this->newTitle, $user ] );
+
                $pageid = $this->oldTitle->getArticleID( Title::GAID_FOR_UPDATE );
                $protected = $this->oldTitle->isProtected();