Fix bug 16356. Use proper normalization for dumpInterwiki.inc
authorDerk-Jan Hartman <hartman@users.mediawiki.org>
Tue, 15 Jun 2010 13:47:38 +0000 (13:47 +0000)
committerDerk-Jan Hartman <hartman@users.mediawiki.org>
Tue, 15 Jun 2010 13:47:38 +0000 (13:47 +0000)
It was previously breaking on multibyte characters and space characters in interwiki entries.

Patch by User:Umherirrender, Review by ^demon

CREDITS
RELEASE-NOTES
maintenance/dumpInterwiki.inc

diff --git a/CREDITS b/CREDITS
index 7b24692..10a77d4 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -127,6 +127,7 @@ following names for their contribution to the product.
 * Str4nd
 * svip
 * Tisane
+* Umherirrender
 * Zachary Hauri
 
 == Translators ==
index 3552083..8224914 100644 (file)
@@ -196,6 +196,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   accidently activated when hitting enter.
 * (bug 23845) Special:ListFiles now uses correct file names without underscores
 * Ask for permanent login in Special:Preferences only if $wgCookieExpiration > 0
+* (bug 16356) Repair dumpInterwiki.inc to use proper normalization.
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent.
index 1f8bb55..97e5be9 100644 (file)
@@ -29,7 +29,7 @@ class Site {
 }
 
 function getRebuildInterwikiDump() {
-       global $langlist, $languageAliases, $prefixRewrites;
+       global $langlist, $languageAliases, $prefixRewrites, $wgContLang;
 
        # Multi-language sites
        # db suffix => db suffix, iw prefix, hostname
@@ -102,6 +102,8 @@ function getRebuildInterwikiDump() {
        # Global iterwiki map
        foreach ( $lines as $line ) {
                if ( preg_match( '/^\|\s*(.*?)\s*\|\|\s*(.*?)\s*$/', $line, $matches ) ) {
+                       $prefix = $wgContLang->lc( $matches[1] );
+                       $prefix = str_replace( ' ', '_', $prefix );
                        $prefix = strtolower( $matches[1] );
                        $url = $matches[2];
                        if ( preg_match( '/(wikipedia|wiktionary|wikisource|wikiquote|wikibooks|wikimedia)\.org/', $url ) ) {