From: Aaron Schulz Date: Sat, 24 Oct 2015 21:47:19 +0000 (-0700) Subject: Move MemcachedBagOStuff b/c logic to ObjectCache X-Git-Tag: 1.31.0-rc.0~9265 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=0dd27b1da9e45;p=lhc%2Fweb%2Fwiklou.git Move MemcachedBagOStuff b/c logic to ObjectCache Change-Id: Iedb173b00d543237b3e7560b8079b8d488e00d80 --- diff --git a/includes/objectcache/MemcachedBagOStuff.php b/includes/objectcache/MemcachedBagOStuff.php index e9df6a37d4..749c6d3acf 100644 --- a/includes/objectcache/MemcachedBagOStuff.php +++ b/includes/objectcache/MemcachedBagOStuff.php @@ -37,21 +37,9 @@ class MemcachedBagOStuff extends BagOStuff { * @return array */ protected function applyDefaultParams( $params ) { - if ( !isset( $params['servers'] ) ) { - $params['servers'] = $GLOBALS['wgMemCachedServers']; - } - if ( !isset( $params['debug'] ) ) { - $params['debug'] = $GLOBALS['wgMemCachedDebug']; - } - if ( !isset( $params['persistent'] ) ) { - $params['persistent'] = $GLOBALS['wgMemCachedPersistent']; - } if ( !isset( $params['compress_threshold'] ) ) { $params['compress_threshold'] = 1500; } - if ( !isset( $params['timeout'] ) ) { - $params['timeout'] = $GLOBALS['wgMemCachedTimeout']; - } if ( !isset( $params['connect_timeout'] ) ) { $params['connect_timeout'] = 0.5; } diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php index 151bb065f9..f21b797a13 100644 --- a/includes/objectcache/ObjectCache.php +++ b/includes/objectcache/ObjectCache.php @@ -178,8 +178,26 @@ class ObjectCache { return call_user_func( $params['factory'], $params ); } elseif ( isset( $params['class'] ) ) { $class = $params['class']; - if ( $class === 'MultiWriteBagOStuff' && !isset( $params['asyncHandler'] ) ) { - $params['asyncHandler'] = 'DeferredUpdates::addCallableUpdate'; + // Automatically set the 'async' update handler + if ( $class === 'MultiWriteBagOStuff' ) { + $params['asyncHandler'] = isset( $params['asyncHandler'] ) + ? $params['asyncHandler'] + : 'DeferredUpdates::addCallableUpdate'; + } + // Do b/c logic for MemcachedBagOStuff + if ( is_subclass_of( $class, 'MemcachedBagOStuff' ) ) { + if ( !isset( $params['servers'] ) ) { + $params['servers'] = $GLOBALS['wgMemCachedServers']; + } + if ( !isset( $params['debug'] ) ) { + $params['debug'] = $GLOBALS['wgMemCachedDebug']; + } + if ( !isset( $params['persistent'] ) ) { + $params['persistent'] = $GLOBALS['wgMemCachedPersistent']; + } + if ( !isset( $params['timeout'] ) ) { + $params['timeout'] = $GLOBALS['wgMemCachedTimeout']; + } } return new $class( $params ); } else {