Merge "Various dependency injection cleanups to LoadBalancer"
[lhc/web/wiklou.git] / includes / db / loadbalancer / LBFactory.php
index 74353b4..440954f 100644 (file)
@@ -149,7 +149,7 @@ abstract class LBFactory implements DestructibleService {
         * @deprecated since 1.27, use LBFactory::destroy()
         */
        public static function destroyInstance() {
-               self::singleton()->destroy();
+               MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->destroy();
        }
 
        /**
@@ -643,6 +643,20 @@ abstract class LBFactory implements DestructibleService {
                } );
        }
 
+       /**
+        * Base parameters to LoadBalancer::__construct()
+        */
+       final protected function baseLoadBalancerParams() {
+               return [
+                       'readOnlyReason' => $this->readOnlyReason,
+                       'trxProfiler' => $this->trxProfiler,
+                       'srvCache' => $this->srvCache,
+                       'wanCache' => $this->wanCache,
+                       'localDomain' => wfWikiID(),
+                       'errorLogger' => [ MWExceptionHandler::class, 'logException' ]
+               ];
+       }
+
        /**
         * @param LoadBalancer $lb
         */