X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=blobdiff_plain;f=includes%2Fobjectcache%2FObjectCache.php;h=f1a96c87569ae3cd7b1eb92d15484e27c642a7c7;hb=1b57f6a81be7ac1e9e7e71b3bae0ab2d8fc94a5d;hp=ffbc3783c42705914736f503c0183cc0d43f16c7;hpb=bd62b3562ab80c5da331fe4d4eeb9bbf336e79c3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php index ffbc3783c4..f1a96c8756 100644 --- a/includes/objectcache/ObjectCache.php +++ b/includes/objectcache/ObjectCache.php @@ -119,7 +119,7 @@ class ObjectCache { * @return BagOStuff * @throws InvalidArgumentException */ - public static function newFromId( $id ) { + private static function newFromId( $id ) { global $wgObjectCaches; if ( !isset( $wgObjectCaches[$id] ) ) { @@ -146,7 +146,7 @@ class ObjectCache { * * @return string */ - public static function getDefaultKeyspace() { + private static function getDefaultKeyspace() { global $wgCachePrefix; $keyspace = $wgCachePrefix; @@ -178,7 +178,8 @@ class ObjectCache { } elseif ( isset( $params['class'] ) ) { $class = $params['class']; // Automatically set the 'async' update handler - $params['asyncHandler'] = $params['asyncHandler'] ?? 'DeferredUpdates::addCallableUpdate'; + $params['asyncHandler'] = $params['asyncHandler'] + ?? [ DeferredUpdates::class, 'addCallableUpdate' ]; // Enable reportDupes by default $params['reportDupes'] = $params['reportDupes'] ?? true; // Do b/c logic for SqlBagOStuff @@ -296,7 +297,7 @@ class ObjectCache { * @return WANObjectCache * @throws UnexpectedValueException */ - public static function newWANCacheFromId( $id ) { + private static function newWANCacheFromId( $id ) { global $wgWANObjectCaches, $wgObjectCaches; if ( !isset( $wgWANObjectCaches[$id] ) ) { @@ -392,12 +393,19 @@ class ObjectCache { */ public static function detectLocalServerCache() { if ( function_exists( 'apcu_fetch' ) ) { - return 'apcu'; + // Make sure the APCu methods actually store anything + if ( PHP_SAPI !== 'cli' || ini_get( 'apc.enable_cli' ) ) { + return 'apcu'; + } } elseif ( function_exists( 'apc_fetch' ) ) { - return 'apc'; + // Make sure the APC methods actually store anything + if ( PHP_SAPI !== 'cli' || ini_get( 'apc.enable_cli' ) ) { + return 'apc'; + } } elseif ( function_exists( 'wincache_ucache_get' ) ) { return 'wincache'; } + return CACHE_NONE; } }