From d9370003fb801c22cc6ab9f09f15c26e11ca19cd Mon Sep 17 00:00:00 2001 From: Amir Sarabadani Date: Wed, 17 Jan 2024 19:53:40 +0100 Subject: maintenance: Introduce getReplicaDB() and getPrimaryDB() And start using them instead of wfGetDB(), LB/LBF connection methods or worse, $this->getDB(). $this->getDB() reuses the database object regardless of whether you're calling a replica or primary, leading to returning a replica on a primary and other way around. Bug: T330641 Change-Id: I9e2cf85ca277022284fc26b9f37db57bd12aaa81 --- maintenance/userOptions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'maintenance/userOptions.php') diff --git a/maintenance/userOptions.php b/maintenance/userOptions.php index d3f737027d27..8c94aa824b30 100644 --- a/maintenance/userOptions.php +++ b/maintenance/userOptions.php @@ -177,7 +177,7 @@ WARN $userOptionsManager = $this->getServiceContainer()->getUserOptionsManager(); $tempUserConfig = $this->getServiceContainer()->getTempUserConfig(); - $dbr = $this->getDB( DB_REPLICA ); + $dbr = $this->getReplicaDB(); $queryBuilderTemplate = new SelectQueryBuilder( $dbr ); $queryBuilderTemplate ->table( 'user' ) @@ -258,8 +258,8 @@ WARN ); } - $dbr = $this->getDB( DB_REPLICA ); - $dbw = $this->getDB( DB_PRIMARY ); + $dbr = $this->getReplicaDB(); + $dbw = $this->getPrimaryDB(); $rowsNum = 0; $rowsInThisBatch = -1; -- cgit v1.2.3