Added SpecialPageAfterExecute and SpecialPageBeforeExecute hooks
authorjeroendedauw <jeroendedauw@gmail.com>
Fri, 6 Jul 2012 11:36:01 +0000 (13:36 +0200)
committerjeroendedauw <jeroendedauw@gmail.com>
Fri, 6 Jul 2012 14:10:42 +0000 (16:10 +0200)
Danwe apparently needs them :)

Change-Id: Ic74c7ba7f4168d2b0cfbd3c4e551218f6cb2693a

RELEASE-NOTES-1.20
docs/hooks.txt
includes/SpecialPage.php

index c85a1c3..63b5d51 100644 (file)
@@ -28,6 +28,8 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki.
 * Added TitleIsAlwaysKnown hook which gets called when determining if a page exists.
 * Added NamespaceIsMovable hook which gets called when determining if pages in a
   certain namespace can be moved.
+* Added SpecialPageBeforeExecute hook which gets called before SpecialPage::execute.
+* Added SpecialPageAfterExecute hook which gets called after SpecialPage::execute.
 * (bug 32341) Add upload by URL domain limitation.
 * &useskin=default will now always display the default skin. Useful for users with a
   preference for the non-default skin to look at something using the default skin.
index 70c334a..47654ce 100644 (file)
@@ -1852,6 +1852,14 @@ Each key maps to an associative array with a 'msg' (message key) and a 'default'
 hook to remove a core special page
 $list: list (array) of core special pages
 
+'SpecialPageAfterExecute': called after SpecialPage::execute
+$special: the SpecialPage object
+$subPage: the subpage string or null if no subpage was specified
+
+'SpecialPageBeforeExecute': called before SpecialPage::execute
+$special: the SpecialPage object
+$subPage: the subpage string or null if no subpage was specified
+
 'SpecialPasswordResetOnSubmit': when executing a form submission on Special:PasswordReset
 $users: array of User objects
 $data: array of data submitted by the user
index cbd7134..ba6db79 100644 (file)
@@ -597,9 +597,29 @@ class SpecialPage {
         * @param $subPage string|null
         */
        public final function run( $subPage ) {
+               /**
+                * Gets called before @see SpecialPage::execute.
+                *
+                * @since 1.20
+                *
+                * @param $special SpecialPage
+                * @param $subPage string|null
+                */
+               wfRunHooks( 'SpecialPageBeforeExecute', array( &$this, $subPage ) );
+
                $this->beforeExecute( $subPage );
                $this->execute( $subPage );
                $this->afterExecute( $subPage );
+
+               /**
+                * Gets called after @see SpecialPage::execute.
+                *
+                * @since 1.20
+                *
+                * @param $special SpecialPage
+                * @param $subPage string|null
+                */
+               wfRunHooks( 'SpecialPageAfterExecute', array( &$this, $subPage ) );
        }
 
        /**