rdbms: Remove obsolete comment in LoadBalancerSingle
[lhc/web/wiklou.git] / includes / libs / rdbms / loadbalancer / LoadBalancerSingle.php
index 1b72502..a3e57ae 100644 (file)
@@ -26,7 +26,7 @@ namespace Wikimedia\Rdbms;
 use InvalidArgumentException;
 
 /**
- * Trivial LoadBalancer that always returns an injected connection handle
+ * Trivial LoadBalancer that always returns an injected connection handle.
  */
 class LoadBalancerSingle extends LoadBalancer {
        /** @var IDatabase */
@@ -54,7 +54,9 @@ class LoadBalancerSingle extends LoadBalancer {
                        ],
                        'trxProfiler' => $params['trxProfiler'] ?? null,
                        'srvCache' => $params['srvCache'] ?? null,
-                       'wanCache' => $params['wanCache'] ?? null
+                       'wanCache' => $params['wanCache'] ?? null,
+                       'localDomain' => $params['localDomain'] ?? $this->db->getDomainID(),
+                       'readOnlyReason' => $params['readOnlyReason'] ?? false,
                ] );
 
                if ( isset( $params['readOnlyReason'] ) ) {
@@ -69,12 +71,20 @@ class LoadBalancerSingle extends LoadBalancer {
         * @since 1.28
         */
        public static function newFromConnection( IDatabase $db, array $params = [] ) {
-               return new static( [ 'connection' => $db ] + $params );
+               return new static( array_merge(
+                       [ 'localDomain' => $db->getDomainID() ],
+                       $params,
+                       [ 'connection' => $db ]
+               ) );
        }
 
-       protected function reallyOpenConnection( array $server, DatabaseDomain $domainOverride ) {
+       protected function reallyOpenConnection( array $server, DatabaseDomain $domain ) {
                return $this->db;
        }
+
+       public function __destruct() {
+               // do nothing since the connection was injected
+       }
 }
 
 /**