Merge "Add dotall modifier to EDITSECTION_REGEX"
[lhc/web/wiklou.git] / includes / libs / rdbms / lbfactory / LBFactoryMulti.php
index 2fb8c4b..1d22873 100644 (file)
@@ -95,7 +95,7 @@ class LBFactoryMulti extends LBFactory {
        private $extLBs = [];
 
        /** @var string */
-       private $loadMonitorClass;
+       private $loadMonitorClass = 'LoadMonitor';
 
        /** @var string */
        private $lastDomain;
@@ -255,13 +255,7 @@ class LBFactoryMulti extends LBFactory {
                return $this->mainLBs[$section];
        }
 
-       /**
-        * @param string $cluster
-        * @param DatabaseDomain|string|bool $domain Domain ID, or false for the current domain
-        * @throws InvalidArgumentException
-        * @return LoadBalancer
-        */
-       public function newExternalLB( $cluster, $domain = false ) {
+       public function newExternalLB( $cluster ) {
                if ( !isset( $this->externalLoads[$cluster] ) ) {
                        throw new InvalidArgumentException( __METHOD__ . ": Unknown cluster \"$cluster\"" );
                }
@@ -281,20 +275,35 @@ class LBFactoryMulti extends LBFactory {
                );
        }
 
-       /**
-        * @param string $cluster External storage cluster, or false for core
-        * @param DatabaseDomain|string|bool $domain Domain ID, or false for the current domain
-        * @return LoadBalancer
-        */
-       public function getExternalLB( $cluster, $domain = false ) {
+       public function getExternalLB( $cluster ) {
                if ( !isset( $this->extLBs[$cluster] ) ) {
-                       $this->extLBs[$cluster] = $this->newExternalLB( $cluster, $domain );
+                       $this->extLBs[$cluster] = $this->newExternalLB( $cluster );
                        $this->getChronologyProtector()->initLB( $this->extLBs[$cluster] );
                }
 
                return $this->extLBs[$cluster];
        }
 
+       public function getAllMainLBs() {
+               $lbs = [];
+               foreach ( $this->sectionsByDB as $db => $section ) {
+                       if ( !isset( $lbs[$section] ) ) {
+                               $lbs[$section] = $this->getMainLB( $db );
+                       }
+               }
+
+               return $lbs;
+       }
+
+       public function getAllExternalLBs() {
+               $lbs = [];
+               foreach ( $this->externalLoads as $cluster => $unused ) {
+                       $lbs[$cluster] = $this->getExternalLB( $cluster );
+               }
+
+               return $lbs;
+       }
+
        /**
         * Make a new load balancer object based on template and load array
         *
@@ -309,7 +318,7 @@ class LBFactoryMulti extends LBFactory {
                        $this->baseLoadBalancerParams(),
                        [
                                'servers' => $this->makeServerArray( $template, $loads, $groupLoads ),
-                               'loadMonitor' => $this->loadMonitorClass,
+                               'loadMonitor' => [ 'class' => $this->loadMonitorClass ],
                                'readOnlyReason' => $readOnlyReason
                        ]
                ) );