Avoid/Replace usage of deprecated wfMemcKey() function

This global function was deprecated in 1.30 and is replaced with
the use of `ObjectCache::getLocalClusterInstance()->makeKey()`.

Change-Id: Ic08b53111be4374a973e08c2ed68224bfa922fa8
This commit is contained in:
Derick Alangi 2019-05-02 14:50:34 +01:00 committed by D3r1ck01
parent 18ec468633
commit 1b9ea4d1bf
3 changed files with 8 additions and 4 deletions

View file

@ -288,7 +288,9 @@ class CacheHelper implements ICacheHelper {
throw new MWException( 'No cache key set, so cannot obtain or save the CacheHelper values.' );
}
return wfMemcKey( ...array_values( $this->cacheKey ) );
return ObjectCache::getLocalClusterInstance()->makeKey(
...array_values( $this->cacheKey )
);
}
/**

View file

@ -114,7 +114,9 @@ class PoolWorkArticleView extends PoolCounterWork {
$this->revision = $revision;
$this->audience = $audience;
$this->cacheKey = $this->parserCache->getKey( $page, $parserOptions );
$keyPrefix = $this->cacheKey ?: wfMemcKey( 'articleview', 'missingcachekey' );
$keyPrefix = $this->cacheKey ?: ObjectCache::getLocalClusterInstance()->makeKey(
'articleview', 'missingcachekey'
);
parent::__construct( 'ArticleView', $keyPrefix . ':revid:' . $revid );
}

View file

@ -2670,7 +2670,7 @@ class AuthManagerTest extends \MediaWikiTestCase {
// Test backoff
$cache = \ObjectCache::getLocalClusterInstance();
$backoffKey = wfMemcKey( 'AuthManager', 'autocreate-failed', md5( $username ) );
$backoffKey = $cache->makeKey( 'AuthManager', 'autocreate-failed', md5( $username ) );
$cache->set( $backoffKey, true );
$session->clear();
$user = \User::newFromName( $username );
@ -2709,7 +2709,7 @@ class AuthManagerTest extends \MediaWikiTestCase {
// Test addToDatabase throws an exception
$cache = \ObjectCache::getLocalClusterInstance();
$backoffKey = wfMemcKey( 'AuthManager', 'autocreate-failed', md5( $username ) );
$backoffKey = $cache->makeKey( 'AuthManager', 'autocreate-failed', md5( $username ) );
$this->assertFalse( $cache->get( $backoffKey ), 'sanity check' );
$session->clear();
$user = $this->getMockBuilder( \User::class )