From b5630dc0e1ee9db2994c8863f35ccf271ddc84eb Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 20 Jul 2019 14:09:31 -0700 Subject: [PATCH] Inject getLocalServerObjectCache() into the CachingSiteStore instance This means SiteStore now uses APCu on PHP7 as well. Previously it only used APC on HHVM, and used the main cache (e.g. Memcached) on PHP7. Change-Id: I83ff1d2dd61c611c9976c6f9ca8026a0b6dd6662 --- includes/ServiceWiring.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index b6500a41dc..9073de1c0e 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -263,6 +263,7 @@ return [ 'LocalServerObjectCache' => function ( MediaWikiServices $services ) : BagOStuff { $cacheId = \ObjectCache::detectLocalServerCache(); + return \ObjectCache::newFromId( $cacheId ); }, @@ -621,9 +622,10 @@ return [ 'SiteStore' => function ( MediaWikiServices $services ) : SiteStore { $rawSiteStore = new DBSiteStore( $services->getDBLoadBalancer() ); - // TODO: replace wfGetCache with a CacheFactory service. - // TODO: replace wfIsHHVM with a capabilities service. - $cache = wfGetCache( wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING ); + $cache = $services->getLocalServerObjectCache(); + if ( $cache instanceof EmptyBagOStuff ) { + $cache = ObjectCache::getLocalClusterInstance(); + } return new CachingSiteStore( $rawSiteStore, $cache ); }, -- 2.20.1