aboutsummaryrefslogtreecommitdiffstats
path: root/includes/db
diff options
context:
space:
mode:
authorKunal Mehta <legoktm@member.fsf.org>2020-07-23 02:31:57 -0700
committerTim Starling <tstarling@wikimedia.org>2022-08-31 10:53:50 +1000
commit499a1fe497d16515258f5137f47e8bad1df739a0 (patch)
tree0365e86a43215da230de8a57e89647f3326465ef /includes/db
parent7b88ee10c417748158ddda577f3a79d3244bf6b4 (diff)
downloadmediawikicore-499a1fe497d16515258f5137f47e8bad1df739a0.tar.gz
mediawikicore-499a1fe497d16515258f5137f47e8bad1df739a0.zip
rdbms: Move Database::factory() to DatabaseFactory service
We also bring along Database::attributesFromType(), which relied on the private ::getClass(). This requires us to inject DatabaseFactory through the LBFactory/LoadBalancer hierarchy. Database::factory() is now soft deprecated. All callers outside of includes/installer/ still need migration. Bug: T299691 Bug: T315270 Change-Id: I7d057a9438f1b097554679975e4e9b2fc99e7c2b
Diffstat (limited to 'includes/db')
-rw-r--r--includes/db/MWLBFactory.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/includes/db/MWLBFactory.php b/includes/db/MWLBFactory.php
index 81cea3d78e7b..3b62bde76f14 100644
--- a/includes/db/MWLBFactory.php
+++ b/includes/db/MWLBFactory.php
@@ -27,6 +27,7 @@ use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MainConfigNames;
use Wikimedia\Rdbms\ChronologyProtector;
use Wikimedia\Rdbms\DatabaseDomain;
+use Wikimedia\Rdbms\DatabaseFactory;
use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\ILBFactory;
use Wikimedia\Rdbms\LBFactory;
@@ -95,6 +96,10 @@ class MWLBFactory {
* @var StatsdDataFactoryInterface
*/
private $statsdDataFactory;
+ /**
+ * @var DatabaseFactory
+ */
+ private $databaseFactory;
/**
* @param ServiceOptions $options
@@ -104,6 +109,7 @@ class MWLBFactory {
* @param WANObjectCache $wanCache
* @param CriticalSectionProvider $csProvider
* @param StatsdDataFactoryInterface $statsdDataFactory
+ * @param DatabaseFactory $databaseFactory
*/
public function __construct(
ServiceOptions $options,
@@ -112,7 +118,8 @@ class MWLBFactory {
BagOStuff $srvCache,
WANObjectCache $wanCache,
CriticalSectionProvider $csProvider,
- StatsdDataFactoryInterface $statsdDataFactory
+ StatsdDataFactoryInterface $statsdDataFactory,
+ DatabaseFactory $databaseFactory
) {
$this->options = $options;
$this->readOnlyMode = $readOnlyMode;
@@ -121,6 +128,7 @@ class MWLBFactory {
$this->wanCache = $wanCache;
$this->csProvider = $csProvider;
$this->statsdDataFactory = $statsdDataFactory;
+ $this->databaseFactory = $databaseFactory;
}
/**
@@ -212,6 +220,7 @@ class MWLBFactory {
$lbConf['cpStash'] = $this->cpStash;
$lbConf['srvCache'] = $this->srvCache;
$lbConf['wanCache'] = $this->wanCache;
+ $lbConf['databaseFactory'] = $this->databaseFactory;
return $lbConf;
}