Avoid usage of deprecated wfGetMainCache() function
authorDerick Alangi <alangiderick@gmail.com>
Sun, 28 Apr 2019 19:41:17 +0000 (20:41 +0100)
committerDerick Alangi <alangiderick@gmail.com>
Sun, 28 Apr 2019 19:41:17 +0000 (20:41 +0100)
This function was deprecated in 1.32 and replaced with the use of
ObjectCache::getLocalClusterInstance().

Change-Id: Id50700a6a7110888b12c4ee1a2100134173760a0

tests/phpunit/includes/site/CachingSiteStoreTest.php
tests/phpunit/suites/UploadFromUrlTestSuite.php

index 0fdcf6d..f04d35c 100644 (file)
@@ -37,7 +37,7 @@ class CachingSiteStoreTest extends MediaWikiTestCase {
 
                $store = new CachingSiteStore(
                        $this->getHashSiteStore( $testSites ),
-                       wfGetMainCache()
+                       ObjectCache::getLocalClusterInstance()
                );
 
                $sites = $store->getSites();
@@ -62,7 +62,9 @@ class CachingSiteStoreTest extends MediaWikiTestCase {
         * @covers CachingSiteStore::saveSites
         */
        public function testSaveSites() {
-               $store = new CachingSiteStore( new HashSiteStore(), wfGetMainCache() );
+               $store = new CachingSiteStore(
+                       new HashSiteStore(), ObjectCache::getLocalClusterInstance()
+               );
 
                $sites = [];
 
@@ -108,7 +110,7 @@ class CachingSiteStoreTest extends MediaWikiTestCase {
                                return $siteList;
                        } ) );
 
-               $store = new CachingSiteStore( $dbSiteStore, wfGetMainCache() );
+               $store = new CachingSiteStore( $dbSiteStore, ObjectCache::getLocalClusterInstance() );
 
                // initialize internal cache
                $this->assertGreaterThan( 0, $store->getSites()->count(), 'count sites' );
@@ -138,7 +140,9 @@ class CachingSiteStoreTest extends MediaWikiTestCase {
         * @covers CachingSiteStore::clear
         */
        public function testClear() {
-               $store = new CachingSiteStore( new HashSiteStore(), wfGetMainCache() );
+               $store = new CachingSiteStore(
+                       new HashSiteStore(), ObjectCache::getLocalClusterInstance()
+               );
                $this->assertTrue( $store->clear() );
 
                $site = $store->getSite( 'enwiki' );
index 00d607f..3b6d6f2 100644 (file)
@@ -57,7 +57,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite {
 
                $wgParserCacheType = CACHE_NONE;
                DeferredUpdates::clearPendingUpdates();
-               $wgMemc = wfGetMainCache();
+               $wgMemc = ObjectCache::getLocalClusterInstance();
                $messageMemc = wfGetMessageCacheStorage();
 
                RequestContext::resetMain();