r21376 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21375‎ | r21376 | r21377 >
Date:13:40, 19 April 2007
Author:brion
Status:old
Tags:
Comment:
Revert r21363; triggers PHP notices due to failed lookups for interwiki prefixes
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -1645,7 +1645,12 @@
16461646 $m = array();
16471647 if ( preg_match( "/^(.+?)_*:_*(.*)$/S", $dbkey, $m ) ) {
16481648 $p = $m[1];
1649 - if ( $ns = $wgContLang->getNsIndex( $p )) {
 1649+ $lowerNs = $wgContLang->lc( $p );
 1650+ if ( $ns = Namespace::getCanonicalIndex( $lowerNs ) ) {
 1651+ # Canonical namespace
 1652+ $dbkey = $m[2];
 1653+ $this->mNamespace = $ns;
 1654+ } elseif ( $ns = $wgContLang->getNsIndex( $lowerNs )) {
16501655 # Ordinary namespace
16511656 $dbkey = $m[2];
16521657 $this->mNamespace = $ns;
Index: trunk/phase3/languages/Language.php
@@ -228,33 +228,15 @@
229229 }
230230
231231 /**
232 - * Get a namespace key by value, case insensitive.
233 - * Only matches namespace names for the current language, not the
234 - * canonical ones defined in Namespace.php.
 232+ * Get a namespace key by value, case insensetive.
235233 *
236234 * @param string $text
237235 * @return mixed An integer if $text is a valid value otherwise false
238236 */
239 - function getLocalNsIndex( $text ) {
240 - $this->load();
241 - $lctext = $this->lc($text);
242 - if( ( $ns = $this->mNamespaceIds[$lctext] ) !== null ) return $ns;
243 - return false;
244 - }
245 -
246 - /**
247 - * Get a namespace key by value, case insensitive. Canonical namespace
248 - * names override custom ones defined for the current language.
249 - *
250 - * @param string $text
251 - * @return mixed An integer if $text is a valid value otherwise false
252 - */
253237 function getNsIndex( $text ) {
254238 $this->load();
255239 $lctext = $this->lc($text);
256 - if( ( $ns = Namespace::getCanonicalIndex( $lctext ) ) !== null ) return $ns;
257 - if( ( $ns = $this->mNamespaceIds[$lctext] ) !== null ) return $ns;
258 - return false;
 240+ return isset( $this->mNamespaceIds[$lctext] ) ? $this->mNamespaceIds[$lctext] : false;
259241 }
260242
261243 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r21363make ->getNsIndex() check canonical namespace names too, remove now redundant...vyznev10:03, 19 April 2007