* @return BagOStuff
* @throws InvalidArgumentException
*/
- public static function newFromId( $id ) {
+ private static function newFromId( $id ) {
global $wgObjectCaches;
if ( !isset( $wgObjectCaches[$id] ) ) {
*
* @return string
*/
- public static function getDefaultKeyspace() {
+ private static function getDefaultKeyspace() {
global $wgCachePrefix;
$keyspace = $wgCachePrefix;
} 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
if ( !isset( $params['servers'] ) ) {
$params['servers'] = $GLOBALS['wgMemCachedServers'];
}
- if ( !isset( $params['debug'] ) ) {
- $params['debug'] = $GLOBALS['wgMemCachedDebug'];
- }
if ( !isset( $params['persistent'] ) ) {
$params['persistent'] = $GLOBALS['wgMemCachedPersistent'];
}
* @return WANObjectCache
* @throws UnexpectedValueException
*/
- public static function newWANCacheFromId( $id ) {
+ private static function newWANCacheFromId( $id ) {
global $wgWANObjectCaches, $wgObjectCaches;
if ( !isset( $wgWANObjectCaches[$id] ) ) {
* @param array $params
* @return WANObjectCache
* @throws UnexpectedValueException
+ * @suppress PhanTypeMismatchReturn
*/
public static function newWANCacheFromParams( array $params ) {
global $wgCommandLineMode, $wgSecretKey;
*/
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;
}
}