r95856 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95855‎ | r95856 | r95857 >
Date:12:18, 31 August 2011
Author:catrope
Status:ok
Tags:
Comment:
Followup r95753 per CR: prevent extensions from making isMovable() return true for interwiki titles and immovable namespaces
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -1805,7 +1805,8 @@
18061806 $title: Title object that is being checked
18071807 $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()
18081808
1809 -'TitleIsMovable': Called when determining if it is possible to move a page
 1809+'TitleIsMovable': Called when determining if it is possible to move a page.
 1810+Note that this hook is not called for interwiki pages or pages in immovable namespaces: for these, isMovable() always returns false.
18101811 $title: Title object that is being checked
18111812 $result: Boolean; whether MediaWiki currently thinks this page is movable. Hooks may change this value to override the return value of Title::isMovable()
18121813
Index: trunk/phase3/includes/Title.php
@@ -1786,7 +1786,12 @@
17871787 * @return Bool TRUE or FALSE
17881788 */
17891789 public function isMovable() {
1790 - $result = MWNamespace::isMovable( $this->getNamespace() ) && $this->getInterwiki() == '';
 1790+ if ( !MWNamespace::isMovable( $this->getNamespace() ) || $this->getInterwiki() != '' ) {
 1791+ // Interwiki title or immovable namespace. Hooks don't get to override here
 1792+ return false;
 1793+ }
 1794+
 1795+ $result = true;
17911796 wfRunHooks( 'TitleIsMovable', array( $this, &$result ) );
17921797 return $result;
17931798 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95753Add TitleIsMovable hook so extensions can create new namespaces in which page...catrope11:21, 30 August 2011

Status & tagging log