From: Kunal Mehta Date: Thu, 25 May 2017 19:05:49 +0000 (-0700) Subject: parser: Avoid deprecated wfMemcKey() X-Git-Tag: 1.31.0-rc.0~3119^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=ff8a0c788bc8cfe1d1d0ff1512a2e33cc65a5c0d;p=lhc%2Fweb%2Fwiklou.git parser: Avoid deprecated wfMemcKey() Tested that parser cache keys stay the same, before and after this change. Also use the more obvious ObjectCache::getLocalClusterInstance() instead of looking up the main cache type in config and using ObjectCache::getInstance(). Change-Id: Icef646b3c05e732ef4079d6900e6bce111debf2b --- diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index f76c0b5dec..76a7e1ed7a 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -67,7 +67,7 @@ class ParserCache { $pageid = $article->getId(); $renderkey = (int)( $wgRequest->getVal( 'action' ) == 'render' ); - $key = wfMemcKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}" ); + $key = $this->mMemc->makeKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}" ); return $key; } @@ -76,7 +76,7 @@ class ParserCache { * @return mixed|string */ protected function getOptionsKey( $page ) { - return wfMemcKey( 'pcache', 'idoptions', $page->getId() ); + return $this->mMemc->makeKey( 'pcache', 'idoptions', $page->getId() ); } /** diff --git a/includes/parser/Preprocessor.php b/includes/parser/Preprocessor.php index cb8e3a7f72..24474d5795 100644 --- a/includes/parser/Preprocessor.php +++ b/includes/parser/Preprocessor.php @@ -72,12 +72,12 @@ abstract class Preprocessor { return false; } - $key = wfMemcKey( + $cache = ObjectCache::getLocalClusterInstance(); + $key = $cache->makeKey( defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class, md5( $text ), $flags ); $value = sprintf( "%08d", static::CACHE_VERSION ) . $tree; - $cache = ObjectCache::getInstance( $config->get( 'MainCacheType' ) ); $cache->set( $key, $value, 86400 ); LoggerFactory::getInstance( 'Preprocessor' ) @@ -101,9 +101,9 @@ abstract class Preprocessor { return false; } - $cache = ObjectCache::getInstance( $config->get( 'MainCacheType' ) ); + $cache = ObjectCache::getLocalClusterInstance(); - $key = wfMemcKey( + $key = $cache->makeKey( defined( 'static::CACHE_PREFIX' ) ? static::CACHE_PREFIX : static::class, md5( $text ), $flags );