From: Brion Vibber Date: Thu, 19 Apr 2007 13:40:06 +0000 (+0000) Subject: Revert r21363; triggers PHP notices due to failed lookups for interwiki prefixes X-Git-Tag: 1.31.0-rc.0~53359 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=fd7e5aac2d46a074953e5ab48c10c4a2efae96bc;p=lhc%2Fweb%2Fwiklou.git Revert r21363; triggers PHP notices due to failed lookups for interwiki prefixes --- diff --git a/includes/Title.php b/includes/Title.php index 531944aae5..d7b29ec34b 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1645,7 +1645,12 @@ class Title { $m = array(); if ( preg_match( "/^(.+?)_*:_*(.*)$/S", $dbkey, $m ) ) { $p = $m[1]; - if ( $ns = $wgContLang->getNsIndex( $p )) { + $lowerNs = $wgContLang->lc( $p ); + if ( $ns = Namespace::getCanonicalIndex( $lowerNs ) ) { + # Canonical namespace + $dbkey = $m[2]; + $this->mNamespace = $ns; + } elseif ( $ns = $wgContLang->getNsIndex( $lowerNs )) { # Ordinary namespace $dbkey = $m[2]; $this->mNamespace = $ns; diff --git a/languages/Language.php b/languages/Language.php index cc12fe9496..4f217918c6 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -228,23 +228,7 @@ class Language { } /** - * Get a namespace key by value, case insensitive. - * Only matches namespace names for the current language, not the - * canonical ones defined in Namespace.php. - * - * @param string $text - * @return mixed An integer if $text is a valid value otherwise false - */ - function getLocalNsIndex( $text ) { - $this->load(); - $lctext = $this->lc($text); - if( ( $ns = $this->mNamespaceIds[$lctext] ) !== null ) return $ns; - return false; - } - - /** - * Get a namespace key by value, case insensitive. Canonical namespace - * names override custom ones defined for the current language. + * Get a namespace key by value, case insensetive. * * @param string $text * @return mixed An integer if $text is a valid value otherwise false @@ -252,9 +236,7 @@ class Language { function getNsIndex( $text ) { $this->load(); $lctext = $this->lc($text); - if( ( $ns = Namespace::getCanonicalIndex( $lctext ) ) !== null ) return $ns; - if( ( $ns = $this->mNamespaceIds[$lctext] ) !== null ) return $ns; - return false; + return isset( $this->mNamespaceIds[$lctext] ) ? $this->mNamespaceIds[$lctext] : false; } /**