X-Git-Url: http://git.cyclocoop.org/%28?a=blobdiff_plain;f=includes%2Fdb%2Floadbalancer%2FLoadBalancer.php;h=a7c486c69c14096dbfdf6f9c5aa8d9dab6090c05;hb=b54d9cb68067a4a274b518a510b59cedabab937f;hp=dbf031ebaaac94caed1bc0de4b91a902020e4cf9;hpb=cb315086b1d83656172cbdada8a40b0db4dfc4eb;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/db/loadbalancer/LoadBalancer.php b/includes/db/loadbalancer/LoadBalancer.php index dbf031ebaa..a7c486c69c 100644 --- a/includes/db/loadbalancer/LoadBalancer.php +++ b/includes/db/loadbalancer/LoadBalancer.php @@ -91,6 +91,8 @@ class LoadBalancer { * - servers : Required. Array of server info structures. * - loadMonitor : Name of a class used to fetch server lag and load. * - readOnlyReason : Reason the master DB is read-only if so [optional] + * - srvCache : BagOStuff object [optional] + * - wanCache : WANObjectCache object [optional] * @throws MWException */ public function __construct( array $params ) { @@ -138,9 +140,16 @@ class LoadBalancer { } } - $this->srvCache = ObjectCache::getLocalServerInstance(); - $this->wanCache = ObjectCache::getMainWANInstance(); - + if ( isset( $params['srvCache'] ) ) { + $this->srvCache = $params['srvCache']; + } else { + $this->srvCache = new EmptyBagOStuff(); + } + if ( isset( $params['wanCache'] ) ) { + $this->wanCache = $params['wanCache']; + } else { + $this->wanCache = WANObjectCache::newEmpty(); + } if ( isset( $params['trxProfiler'] ) ) { $this->trxProfiler = $params['trxProfiler']; } else { @@ -605,7 +614,7 @@ class LoadBalancer { /** * This can happen in code like: * foreach ( $dbs as $db ) { - * $conn = $lb->getConnection( DB_SLAVE, array(), $db ); + * $conn = $lb->getConnection( DB_SLAVE, [], $db ); * ... * $lb->reuseConnection( $conn ); * }