From: Aaron Schulz Date: Sat, 20 Jul 2019 21:09:31 +0000 (-0700) Subject: Inject getLocalServerObjectCache() into the CachingSiteStore instance X-Git-Tag: 1.34.0-rc.0~862 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=b5630dc0e1ee9db2994c8863f35ccf271ddc84eb;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 ); },