X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=languages%2FLanguageConverter.php;h=6d0368c7a15d63e167475865952023f9a48b1cb8;hb=13bb844fdfff794525e2cb202176ddee3a23ef06;hp=4c3e5be207ceadfba46eb1f8a9c265849e0860ea;hpb=a4943f548be4cfc8f286f00fc8064ff0e377f2ba;p=lhc%2Fweb%2Fwiklou.git diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 4c3e5be207..6d0368c7a1 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -36,6 +36,7 @@ class LanguageConverter { * @var array */ static public $languagesWithVariants = [ + 'en', 'gan', 'iu', 'kk', @@ -60,11 +61,6 @@ class LanguageConverter { // 'bidirectional' 'unidirectional' 'disable' for each variant public $mManualLevel; - /** - * @var string Memcached key name - */ - public $mCacheKey; - public $mLangObj; public $mFlags; public $mDescCodeSep = ':', $mDescVarSep = ';'; @@ -95,7 +91,6 @@ class LanguageConverter { $this->mVariants = array_diff( $variants, $wgDisabledVariants ); $this->mVariantFallbacks = $variantfallbacks; $this->mVariantNames = Language::fetchLanguageNames(); - $this->mCacheKey = wfMemcKey( 'conversiontables', $maincode ); $defaultflags = [ // 'S' show converted text // '+' add rules for alltext @@ -344,7 +339,6 @@ class LanguageConverter { * @return string The converted text */ public function autoConvert( $text, $toVariant = false ) { - $this->loadTables(); if ( !$toVariant ) { @@ -866,8 +860,9 @@ class LanguageConverter { $this->mTablesLoaded = true; $this->mTables = false; $cache = ObjectCache::getInstance( $wgLanguageConverterCacheType ); + $cacheKey = $cache->makeKey( 'conversiontables', $this->mMainLanguageCode ); if ( $fromCache ) { - $this->mTables = $cache->get( $this->mCacheKey ); + $this->mTables = $cache->get( $cacheKey ); } if ( !$this->mTables || !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) { // not in cache, or we need a fresh reload. @@ -882,7 +877,7 @@ class LanguageConverter { $this->postLoadTables(); $this->mTables[self::CACHE_VERSION_KEY] = true; - $cache->set( $this->mCacheKey, $this->mTables, 43200 ); + $cache->set( $cacheKey, $this->mTables, 43200 ); } } @@ -895,9 +890,11 @@ class LanguageConverter { /** * Reload the conversion tables. * + * Also used by test suites which need to reset the converter state. + * * @private */ - function reloadTables() { + private function reloadTables() { if ( $this->mTables ) { unset( $this->mTables ); }