From: jeroendedauw Date: Thu, 10 May 2012 10:19:56 +0000 (+0200) Subject: Adding NamespaceIsMovable hook to isMovable in MWNamespace, much like done in Title... X-Git-Tag: 1.31.0-rc.0~23615^2 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=717e93bd8151d6f354c4d00a7bf4d130a64f20a1;p=lhc%2Fweb%2Fwiklou.git Adding NamespaceIsMovable hook to isMovable in MWNamespace, much like done in Title::isMovable. Change-Id: I72c19be541391857aa25ff2433c017e5d63a8ecd --- diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 78c7c95919..f5f95e561b 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -23,6 +23,8 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki. === New features in 1.20 === * 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. * (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 33db1c53b4..8d4bdea4e8 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1351,6 +1351,11 @@ using this hook. BaseTemplate::makeListItem for details on the format of individual items inside of this array +'NamespaceIsMovable': Called when determining if it is possible to pages in a namespace. +$index: Integer; the index of the namespace being checked. +$result: Boolean; whether MediaWiki currently thinks that pages in this namespace are movable. +Hooks may change this value to override the return value of MWNamespace::isMovable() + 'NewRevisionFromEditComplete': called when a revision was inserted due to an edit $article: the WikiPage edited diff --git a/includes/Namespace.php b/includes/Namespace.php index bdccca16eb..d1fe800a48 100644 --- a/includes/Namespace.php +++ b/includes/Namespace.php @@ -50,7 +50,15 @@ class MWNamespace { */ public static function isMovable( $index ) { global $wgAllowImageMoving; - return !( $index < NS_MAIN || ( $index == NS_FILE && !$wgAllowImageMoving ) || $index == NS_CATEGORY ); + + $result = !( $index < NS_MAIN || ( $index == NS_FILE && !$wgAllowImageMoving ) || $index == NS_CATEGORY ); + + /** + * @since 1.20 + */ + wfRunHooks( 'NamespaceIsMovable', array( $index, &$result ) ); + + return $result; } /**