* Make variant table caching a little more robust, using main language code
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 27 Dec 2006 01:49:09 +0000 (01:49 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 27 Dec 2006 01:49:09 +0000 (01:49 +0000)
  in cache key. Probably this is still a bit wonky, though. Was breaking
  parser tests when Chinese tables were getting loaded into Serbian code.

RELEASE-NOTES
languages/LanguageConverter.php
languages/classes/LanguageSr.php

index e5c2178..d1c6177 100644 (file)
@@ -416,6 +416,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Prevent conversion of JavaScript code in language variants
 * Output software version number in maintenance/parserTests.php
 * (bug 7169) Use Ajax to watch/unwatch articles if enabled
+* Make variant table caching a little more robust, using main language code
+  in cache key. Probably this is still a bit wonky, though. Was breaking
+  parser tests when Chinese tables were getting loaded into Serbian code.
+
 
 == Languages updated ==
 
index 73b7f48..5f2e2fc 100644 (file)
@@ -40,7 +40,7 @@ class LanguageConverter {
                $this->mMainLanguageCode = $maincode;
                $this->mVariants = $variants;
                $this->mVariantFallbacks = $variantfallbacks;
-               $this->mCacheKey = wfMemcKey( 'conversiontables' );
+               $this->mCacheKey = wfMemcKey( 'conversiontables', $maincode );
                $m = array('begin'=>'-{', 'flagsep'=>'|', 'codesep'=>':',
                                   'varsep'=>';', 'end'=>'}-');
                $this->mMarkup = array_merge($m, $markup);
index e3eaf30..2d56aff 100644 (file)
@@ -160,6 +160,9 @@ class SrConverter extends LanguageConverter {
                $matches = preg_split($reg, $text, -1, PREG_SPLIT_OFFSET_CAPTURE);
                
                $m = array_shift($matches);
+               if( !isset( $this->mTables[$toVariant] ) ) {
+                       throw new MWException( "Broken variant table: " . implode( ',', array_keys( $this->mTables ) ) );
+               }
                $ret = $this->mTables[$toVariant]->replace( $m[0] );
                $mstart = $m[1]+strlen($m[0]);
                foreach($matches as $m) {