From c8c50eb1ef4098754d6afe7fdc4edc0ee3022800 Mon Sep 17 00:00:00 2001 From: jeroendedauw Date: Fri, 6 Jul 2012 13:36:01 +0200 Subject: [PATCH] Added SpecialPageAfterExecute and SpecialPageBeforeExecute hooks Danwe apparently needs them :) Change-Id: Ic74c7ba7f4168d2b0cfbd3c4e551218f6cb2693a --- RELEASE-NOTES-1.20 | 2 ++ docs/hooks.txt | 8 ++++++++ includes/SpecialPage.php | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index c85a1c31a3..63b5d51851 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -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. diff --git a/docs/hooks.txt b/docs/hooks.txt index 70c334acec..47654ce9df 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index cbd7134dd3..ba6db79395 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -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 ) ); } /** -- 2.20.1