Followup r95753 per CR: prevent extensions from making isMovable() return true for...
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 31 Aug 2011 12:18:02 +0000 (12:18 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 31 Aug 2011 12:18:02 +0000 (12:18 +0000)
docs/hooks.txt
includes/Title.php

index 3112169..20979f5 100644 (file)
@@ -1805,7 +1805,8 @@ $title: The title in question.
 $title: Title object that is being checked
 $result: Boolean; whether MediaWiki currently thinks this is a CSS/JS page. Hooks may change this value to override the return value of Title::isCssOrJsPage()
 
-'TitleIsMovable': Called when determining if it is possible to move a page
+'TitleIsMovable': Called when determining if it is possible to move a page.
+Note that this hook is not called for interwiki pages or pages in immovable namespaces: for these, isMovable() always returns false.
 $title: Title object that is being checked
 $result: Boolean; whether MediaWiki currently thinks this page is movable. Hooks may change this value to override the return value of Title::isMovable()
 
index 41b8e54..c21b63f 100644 (file)
@@ -1786,7 +1786,12 @@ class Title {
         * @return Bool TRUE or FALSE
         */
        public function isMovable() {
-               $result = MWNamespace::isMovable( $this->getNamespace() ) && $this->getInterwiki() == '';
+               if ( !MWNamespace::isMovable( $this->getNamespace() ) || $this->getInterwiki() != '' ) {
+                       // Interwiki title or immovable namespace. Hooks don't get to override here
+                       return false;
+               }
+               
+               $result = true;
                wfRunHooks( 'TitleIsMovable', array( $this, &$result ) );
                return $result;
        }