r95753 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95752‎ | r95753 | r95754 >
Date:11:21, 30 August 2011
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
Add TitleIsMovable hook so extensions can create new namespaces in which pages can't be moved. RL2 needs this for the Gadgets_definition namespace
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -1800,6 +1800,10 @@
18011801 $title: Title object that is being checked
18021802 $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()
18031803
 1804+'TitleIsMovable': Called when determining if it is possible to move a page
 1805+$title: Title object that is being checked
 1806+$result: Boolean; whether MediaWiki currently thinks this page is movable. Hooks may change this value to override the return value of Title::isMovable()
 1807+
18041808 'TitleIsWikitextPage': Called when determining if a page is a wikitext or should
18051809 be handled by seperate handler (via ArticleViewCustom)
18061810 $title: Title object that is being checked
Index: trunk/phase3/includes/Title.php
@@ -1786,7 +1786,9 @@
17871787 * @return Bool TRUE or FALSE
17881788 */
17891789 public function isMovable() {
1790 - return MWNamespace::isMovable( $this->getNamespace() ) && $this->getInterwiki() == '';
 1790+ $result = MWNamespace::isMovable( $this->getNamespace() ) && $this->getInterwiki() == '';
 1791+ wfRunHooks( 'TitleIsMovable', array( $this, &$result ) );
 1792+ return $result;
17911793 }
17921794
17931795 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r95856Followup r95753 per CR: prevent extensions from making isMovable() return tru...catrope12:18, 31 August 2011

Comments

#Comment by Nikerabbit (talk | contribs)   12:48, 30 August 2011

Was it intended that extensions can allow moving special pages and interwiki titles?

#Comment by Catrope (talk | contribs)   12:50, 30 August 2011

Hmm, you're right, that's probably not a good idea. I'll swap the two such that the core checks override the extension checks.

#Comment by Platonides (talk | contribs)   16:18, 30 August 2011

It should be &$result in hooks.txt

Status & tagging log