Merge "Adding NamespaceIsMovable hook to isMovable in MWNamespace, much like done...
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 14 May 2012 22:23:46 +0000 (22:23 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 14 May 2012 22:23:46 +0000 (22:23 +0000)
RELEASE-NOTES-1.20
docs/hooks.txt
includes/Namespace.php

index 35a3790..2df3043 100644 (file)
@@ -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.
index 33db1c5..8d4bdea 100644 (file)
@@ -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
index a275123..c87a12b 100644 (file)
@@ -65,7 +65,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;
        }
 
        /**