Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311308

Change subject: Move LBFactorySingle to /libs/rdbms
......................................................................

Move LBFactorySingle to /libs/rdbms

Also add newFromConnection() methods for cleaner looking construction
since the IDatabase is fundamental and required.

Change-Id: Ife478d045cee92a30c91e9004833a557488bd512
---
M autoload.php
M includes/installer/DatabaseInstaller.php
R includes/libs/rdbms/lbfactory/LBFactorySingle.php
M includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php
4 files changed, 22 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/08/311308/1

diff --git a/autoload.php b/autoload.php
index a07df96..094c702 100644
--- a/autoload.php
+++ b/autoload.php
@@ -661,7 +661,7 @@
        'LBFactoryMW' => __DIR__ . '/includes/db/loadbalancer/LBFactoryMW.php',
        'LBFactoryMulti' => __DIR__ . 
'/includes/libs/rdbms/lbfactory/LBFactoryMulti.php',
        'LBFactorySimple' => __DIR__ . 
'/includes/libs/rdbms/lbfactory/LBFactorySimple.php',
-       'LBFactorySingle' => __DIR__ . 
'/includes/db/loadbalancer/LBFactorySingle.php',
+       'LBFactorySingle' => __DIR__ . 
'/includes/libs/rdbms/lbfactory/LBFactorySingle.php',
        'LCStore' => __DIR__ . '/includes/cache/localisation/LCStore.php',
        'LCStoreCDB' => __DIR__ . '/includes/cache/localisation/LCStoreCDB.php',
        'LCStoreDB' => __DIR__ . '/includes/cache/localisation/LCStoreDB.php',
diff --git a/includes/installer/DatabaseInstaller.php 
b/includes/installer/DatabaseInstaller.php
index ded2bd8..4f10367 100644
--- a/includes/installer/DatabaseInstaller.php
+++ b/includes/installer/DatabaseInstaller.php
@@ -334,8 +334,7 @@
 
                $connection = $status->value;
                $services->redefineService( 'DBLoadBalancerFactory', function() 
use ( $connection ) {
-                       return new LBFactorySingle( [
-                               'connection' => $connection ] );
+                       return LBFactorySingle::newFromConnection( $connection 
);
                } );
 
        }
diff --git a/includes/db/loadbalancer/LBFactorySingle.php 
b/includes/libs/rdbms/lbfactory/LBFactorySingle.php
similarity index 88%
rename from includes/db/loadbalancer/LBFactorySingle.php
rename to includes/libs/rdbms/lbfactory/LBFactorySingle.php
index b760723..4beb5d8 100644
--- a/includes/db/loadbalancer/LBFactorySingle.php
+++ b/includes/libs/rdbms/lbfactory/LBFactorySingle.php
@@ -43,6 +43,16 @@
        }
 
        /**
+        * @param IDatabase $db Live connection handle
+        * @param array $params Parameter map to LBFactorySingle::__constructs()
+        * @return LBFactorySingle
+        * @since 1.28
+        */
+       public static function newFromConnection( IDatabase $db, array $params 
= [] ) {
+               return new static( [ 'connection' => $db ] + $params );
+       }
+
+       /**
         * @param bool|string $wiki
         * @return LoadBalancerSingle
         */
diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php 
b/includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php
index 943fcf9..9de4850 100644
--- a/includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php
+++ b/includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php
@@ -59,6 +59,16 @@
        }
 
        /**
+        * @param IDatabase $db Live connection handle
+        * @param array $params Parameter map to 
LoadBalancerSingle::__constructs()
+        * @return LoadBalancerSingle
+        * @since 1.28
+        */
+       public static function newFromConnection( IDatabase $db, array $params 
= [] ) {
+               return new static( [ 'connection' => $db ] + $params );
+       }
+
+       /**
         *
         * @param string $server
         * @param bool $dbNameOverride

-- 
To view, visit https://gerrit.wikimedia.org/r/311308
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife478d045cee92a30c91e9004833a557488bd512
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to