diff options
author | Amir Sarabadani <ladsgroup@gmail.com> | 2024-01-17 19:53:40 +0100 |
---|---|---|
committer | Amir Sarabadani <ladsgroup@gmail.com> | 2024-01-18 15:12:04 +0100 |
commit | d9370003fb801c22cc6ab9f09f15c26e11ca19cd (patch) | |
tree | ffe9fe826343d3aba15f321bffc4f9809f0a51cb /maintenance/userOptions.php | |
parent | 6d71df9dcb0fb043db9942819e2f5883cec97c0e (diff) | |
download | mediawikicore-d9370003fb801c22cc6ab9f09f15c26e11ca19cd.tar.gz mediawikicore-d9370003fb801c22cc6ab9f09f15c26e11ca19cd.zip |
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
Diffstat (limited to 'maintenance/userOptions.php')
-rw-r--r-- | maintenance/userOptions.php | 6 |
1 files changed, 3 insertions, 3 deletions
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; |