using the "delete and move" option.
* (bug 13466) White space differences not shown in diffs
* (bug 1953) Search form now honors namespace selections more reliably
+* (bug 12294) Namespace class renamed to MWNamespace for PHP 5.3 compatibility
+* PHP 5.3 compatibility fix for wfRunHooks() called with no parameters
=== API changes in 1.13 ===
'MostrevisionsPage' => 'includes/SpecialMostrevisions.php',
'MovePageForm' => 'includes/SpecialMovepage.php',
'MWException' => 'includes/Exception.php',
+ 'MWNamespace' => 'includes/Namespace.php',
'MySQLSearchResultSet' => 'includes/SearchMySQL.php',
- 'Namespace' => 'includes/Namespace.php',
+ 'Namespace' => 'includes/NamespaceCompat.php', // Compat
'NewbieContributionsPage' => 'includes/SpecialNewbieContributions.php',
'NewPagesPage' => 'includes/SpecialNewpages.php',
'OldChangesList' => 'includes/ChangesList.php',
$found = true;
} else {
$param = str_replace( ' ', '_', strtolower( $part1 ) );
- $index = Namespace::getCanonicalIndex( strtolower( $param ) );
+ $index = MWNamespace::getCanonicalIndex( strtolower( $param ) );
if ( !is_null( $index ) ) {
$text = $wgContLang->getNsText( $index );
$found = true;
*/
class DumpNotalkFilter extends DumpFilter {
function pass( $page ) {
- return !Namespace::isTalk( $page->page_namespace );
+ return !MWNamespace::isTalk( $page->page_namespace );
}
}
* careful about its contents. So, there's a lot more error-checking
* in here than would normally be necessary.
*/
-function wfRunHooks($event, $args = null) {
+function wfRunHooks($event, $args = array()) {
global $wgHooks;
protected function formatLinksInCommentCallback( $match ) {
global $wgContLang;
- $medians = '(?:' . preg_quote( Namespace::getCanonicalName( NS_MEDIA ), '/' ) . '|';
+ $medians = '(?:' . preg_quote( MWNamespace::getCanonicalName( NS_MEDIA ), '/' ) . '|';
$medians .= preg_quote( $wgContLang->getNsText( NS_MEDIA ), '/' ) . '):';
$comment = $match[0];
*
*/
-/*
-WARNING: The statement below may fail on some versions of PHP: see bug 12294
-*/
-
-class Namespace {
+class MWNamespace {
/**
* Can pages in the given namespace be moved?
--- /dev/null
+<?php
+
+// For compatibility with extensions...
+// Will still die on PHP 5.3, of course. :P
+
+class Namespace extends MWNamespace {
+ // ..
+}
+
+?>
\ No newline at end of file
$colours[$pdbk] = ( $threshold == 0 || (
$s->page_len >= $threshold || # always true if $threshold <= 0
$s->page_is_redirect ||
- !Namespace::isContent( $s->page_namespace ) )
+ !MWNamespace::isContent( $s->page_namespace ) )
? 1 : 2 );
}
}
$titleObj =& $this->getTitle();
if ( $rc_type == RC_LOG ) {
- $title = Namespace::getCanonicalName( $titleObj->getNamespace() ) . $titleObj->getText();
+ $title = MWNamespace::getCanonicalName( $titleObj->getNamespace() ) . $titleObj->getText();
} else {
$title = $titleObj->getPrefixedText();
}
$text = wfMsg( $message );
if ( wfEmptyMsg( $message, $text ) ) {
global $wgContLang;
- $text = $wgContLang->getFormattedNsText( Namespace::getSubject( $title->getNamespace() ) );
+ $text = $wgContLang->getFormattedNsText( MWNamespace::getSubject( $title->getNamespace() ) );
}
$result = array();
*/
public function getSubjectNsText() {
global $wgContLang;
- return $wgContLang->getNsText( Namespace::getSubject( $this->mNamespace ) );
+ return $wgContLang->getNsText( MWNamespace::getSubject( $this->mNamespace ) );
}
/**
*/
public function getTalkNsText() {
global $wgContLang;
- return( $wgContLang->getNsText( Namespace::getTalk( $this->mNamespace ) ) );
+ return( $wgContLang->getNsText( MWNamespace::getTalk( $this->mNamespace ) ) );
}
/**
* @return bool
*/
public function canTalk() {
- return( Namespace::canTalk( $this->mNamespace ) );
+ return( MWNamespace::canTalk( $this->mNamespace ) );
}
/**
* @return boolean
*/
public function isMovable() {
- return Namespace::isMovable( $this->getNamespace() )
+ return MWNamespace::isMovable( $this->getNamespace() )
&& $this->getInterwiki() == '';
}
* @return bool
*/
public function isTalkPage() {
- return Namespace::isTalk( $this->getNamespace() );
+ return MWNamespace::isTalk( $this->getNamespace() );
}
/**
* @return Title the object for the talk page
*/
public function getTalkPage() {
- return Title::makeTitle( Namespace::getTalk( $this->getNamespace() ), $this->getDBkey() );
+ return Title::makeTitle( MWNamespace::getTalk( $this->getNamespace() ), $this->getDBkey() );
}
/**
* @return Title the object for the subject page
*/
public function getSubjectPage() {
- return Title::makeTitle( Namespace::getSubject( $this->getNamespace() ), $this->getDBkey() );
+ return Title::makeTitle( MWNamespace::getSubject( $this->getNamespace() ), $this->getDBkey() );
}
/**
*/
public function isWatchable() {
return !$this->isExternal()
- && Namespace::isWatchable( $this->getNamespace() );
+ && MWNamespace::isWatchable( $this->getNamespace() );
}
/**
* @return bool
*/
public function isContentPage() {
- return Namespace::isContent( $this->getNamespace() );
+ return MWNamespace::isContent( $this->getNamespace() );
}
}
if ( is_null( $this->descBaseUrl ) ) {
if ( !is_null( $this->articleUrl ) ) {
$this->descBaseUrl = str_replace( '$1',
- wfUrlencode( Namespace::getCanonicalName( NS_IMAGE ) ) . ':', $this->articleUrl );
+ wfUrlencode( MWNamespace::getCanonicalName( NS_IMAGE ) ) . ':', $this->articleUrl );
} elseif ( !is_null( $this->scriptDirUrl ) ) {
$this->descBaseUrl = $this->scriptDirUrl . '/index.php?title=' .
- wfUrlencode( Namespace::getCanonicalName( NS_IMAGE ) ) . ':';
+ wfUrlencode( MWNamespace::getCanonicalName( NS_IMAGE ) ) . ':';
} else {
$this->descBaseUrl = false;
}
function getDescriptionRenderUrl( $name ) {
if ( isset( $this->scriptDirUrl ) ) {
return $this->scriptDirUrl . '/index.php?title=' .
- wfUrlencode( Namespace::getCanonicalName( NS_IMAGE ) . ':' . $name ) .
+ wfUrlencode( MWNamespace::getCanonicalName( NS_IMAGE ) . ':' . $name ) .
'&action=render';
} else {
$descBase = $this->getDescBaseUrl();
function getNsIndex( $text ) {
$this->load();
$lctext = $this->lc($text);
- if( ( $ns = Namespace::getCanonicalIndex( $lctext ) ) !== null ) return $ns;
+ if( ( $ns = MWNamespace::getCanonicalIndex( $lctext ) ) !== null ) return $ns;
return isset( $this->mNamespaceIds[$lctext] ) ? $this->mNamespaceIds[$lctext] : false;
}
* @return string
*/
function guessPriority( $namespace ) {
- return Namespace::isMain( $namespace ) ? $this->priorities[GS_MAIN] : $this->priorities[GS_TALK];
+ return MWNamespace::isMain( $namespace ) ? $this->priorities[GS_MAIN] : $this->priorities[GS_TALK];
}
/**