Add TitleMove hook
authorJan Gerber <jgerber@wikimedia.org>
Thu, 12 Sep 2013 10:13:21 +0000 (10:13 +0000)
committerJan Gerber <jgerber@wikimedia.org>
Tue, 17 Sep 2013 08:07:17 +0000 (08:07 +0000)
some things need access to the old file before its moved,
adding hook to allow extensions to do something before
file is moved.

Change-Id: Ic5e659abc79c41e3331d42074e7f21eec9b9ba7c

RELEASE-NOTES-1.22
docs/hooks.txt
includes/Title.php

index e503e30..04985c8 100644 (file)
@@ -212,6 +212,7 @@ production.
 * IPv6 addresses in X-Forwarded-For headers are now normalised before checking
   against allowed proxy lists.
 * Add deferrable update support for callback/closure
+* Add TitleMove hook before page renames
 
 === Bug fixes in 1.22 ===
 * Disable Special:PasswordReset when $wgEnableEmail is false. Previously one
index 02413b3..5d6a6e4 100644 (file)
@@ -2419,6 +2419,11 @@ $result: Boolean; whether MediaWiki currently thinks this is a wikitext page.
   Hooks may change this value to override the return value of
   Title::isWikitextPage()
 
+'TitleMove': Before moving an article (title).
+$old: old title
+$nt: new title
+$user: user who does the move
+
 'TitleMoveComplete': After moving an article (title).
 $old: old title
 $nt: new title
index 734e009..3e6f11b 100644 (file)
@@ -3620,6 +3620,8 @@ class Title {
                        $createRedirect = true;
                }
 
+               wfRunHooks( 'TitleMove', array( $this, $nt, $wgUser ) );
+
                // If it is a file, move it first.
                // It is done before all other moving stuff is done because it's hard to revert.
                $dbw = wfGetDB( DB_MASTER );