From: Chad Horohoe Date: Wed, 4 Mar 2015 05:10:57 +0000 (-0800) Subject: Delay language conversion cache construction until needed X-Git-Tag: 1.31.0-rc.0~12191^2 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=997183413102728629657e036cf22144a49b6303;p=lhc%2Fweb%2Fwiklou.git Delay language conversion cache construction until needed Instead of instantiating this on every single request. Removes wfGetLangConverterCacheStorage() and $wgLangConvMemc which were otherwise unused. Change-Id: Ic500944a92c2a94bc649e1b492c33714d81dca00 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 5232413fdd..3f1062054c 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -4008,16 +4008,6 @@ function wfGetParserCacheStorage() { return ObjectCache::getInstance( $wgParserCacheType ); } -/** - * Get the cache object used by the language converter - * - * @return BagOStuff - */ -function wfGetLangConverterCacheStorage() { - global $wgLanguageConverterCacheType; - return ObjectCache::getInstance( $wgLanguageConverterCacheType ); -} - /** * Call hook functions defined in $wgHooks * diff --git a/includes/Setup.php b/includes/Setup.php index 6939f9561c..7c0c7c424d 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -573,7 +573,6 @@ $ps_memcached = Profiler::instance()->scopedProfileIn( $fname . '-memcached' ); $wgMemc = wfGetMainCache(); $messageMemc = wfGetMessageCacheStorage(); $parserMemc = wfGetParserCacheStorage(); -$wgLangConvMemc = wfGetLangConverterCacheStorage(); wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) . ', message: ' . get_class( $messageMemc ) . diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 43d6063d91..844888ee7d 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -842,7 +842,7 @@ class LanguageConverter { * @param bool $fromCache Load from memcached? Defaults to true. */ function loadTables( $fromCache = true ) { - global $wgLangConvMemc; + global $wgLanguageConverterCacheType; if ( $this->mTablesLoaded ) { return; @@ -850,9 +850,10 @@ class LanguageConverter { $this->mTablesLoaded = true; $this->mTables = false; + $cache = ObjectCache::getInstance( $wgLanguageConverterCacheType ); if ( $fromCache ) { wfProfileIn( __METHOD__ . '-cache' ); - $this->mTables = $wgLangConvMemc->get( $this->mCacheKey ); + $this->mTables = $cache->get( $this->mCacheKey ); wfProfileOut( __METHOD__ . '-cache' ); } if ( !$this->mTables || !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) { @@ -869,7 +870,7 @@ class LanguageConverter { $this->postLoadTables(); $this->mTables[self::CACHE_VERSION_KEY] = true; - $wgLangConvMemc->set( $this->mCacheKey, $this->mTables, 43200 ); + $cache->set( $this->mCacheKey, $this->mTables, 43200 ); wfProfileOut( __METHOD__ . '-recache' ); } }