http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95856

Revision: 95856
Author:   catrope
Date:     2011-08-31 12:18:02 +0000 (Wed, 31 Aug 2011)
Log Message:
-----------
Followup r95753 per CR: prevent extensions from making isMovable() return true 
for interwiki titles and immovable namespaces

Modified Paths:
--------------
    trunk/phase3/docs/hooks.txt
    trunk/phase3/includes/Title.php

Modified: trunk/phase3/docs/hooks.txt
===================================================================
--- trunk/phase3/docs/hooks.txt 2011-08-31 12:09:52 UTC (rev 95855)
+++ trunk/phase3/docs/hooks.txt 2011-08-31 12:18:02 UTC (rev 95856)
@@ -1805,7 +1805,8 @@
 $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()
 

Modified: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php     2011-08-31 12:09:52 UTC (rev 95855)
+++ trunk/phase3/includes/Title.php     2011-08-31 12:18:02 UTC (rev 95856)
@@ -1786,7 +1786,12 @@
         * @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;
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to