From 00af3f2598f384277076af9128018efe0ad4c6c6 Mon Sep 17 00:00:00 2001 From: ZoruaFox Date: Tue, 2 Jul 2024 22:53:27 +0800 Subject: [PATCH] Fix wfGetDB deprecated on 1.39 and later versions. The global function wfGetDB() has been deprecated since 1.39, use LoadBalancer::getConnection() instead of old function. Bug: T369145 Change-Id: Ided5ed8d1e54428541f067c75fbe7fdfeefc460f --- src/ContributionScores.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ContributionScores.php b/src/ContributionScores.php index b005a6c..6d5683f 100644 --- a/src/ContributionScores.php +++ b/src/ContributionScores.php @@ -33,7 +33,8 @@ class ContributionScores extends IncludableSpecialPage { } $user = User::newFromName( $usertext ); - $dbr = wfGetDB( DB_REPLICA ); + $loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer(); + $dbr = $loadBalancer->getConnection( DB_REPLICA ); if ( $user instanceof User && $user->isRegistered() ) { global $wgLang; @@ -90,7 +91,8 @@ class ContributionScores extends IncludableSpecialPage { global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoreIgnoreUsernames, $wgContribScoreUseRoughEditCount; - $dbr = wfGetDB( DB_REPLICA ); + $loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer(); + $dbr = $loadBalancer->getConnection( DB_REPLICA ); $revQuery = ActorMigration::newMigration()->getJoin( 'rev_user' ); $revQuery['tables'] = array_merge( [ 'revision' ], $revQuery['tables'] );