Avoid/Replace usage of deprecated `wfMemcKey()` function
authorDerick Alangi <alangiderick@gmail.com>
Thu, 2 May 2019 13:50:34 +0000 (14:50 +0100)
committerD3r1ck01 <xsavitar.wiki@aol.com>
Thu, 2 May 2019 14:27:31 +0000 (14:27 +0000)
This global function was deprecated in 1.30 and is replaced with
the use of `ObjectCache::getLocalClusterInstance()->makeKey()`.

Change-Id: Ic08b53111be4374a973e08c2ed68224bfa922fa8

includes/cache/CacheHelper.php
includes/poolcounter/PoolWorkArticleView.php
tests/phpunit/includes/auth/AuthManagerTest.php

index ec6ce04..d798ddb 100644 (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 )
+               );
        }
 
        /**
index 2c9fbc8..0abe1a5 100644 (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 );
        }
index 209ed55..5cf93c9 100644 (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 )