From 41ac01dfc839b4f1c32a354fe37ed064b8a31585 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 31 Aug 2011 12:18:02 +0000 Subject: [PATCH] Followup r95753 per CR: prevent extensions from making isMovable() return true for interwiki titles and immovable namespaces --- docs/hooks.txt | 3 ++- includes/Title.php | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 3112169e2d..20979f57b7 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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() diff --git a/includes/Title.php b/includes/Title.php index 41b8e54078..c21b63f068 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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; } -- 2.20.1