Replace deprecated wfGetDB

Emits deprecation warnings since 1.42 (30795cda4f59)
Not replacing with IConnectionProvider for compatibility (needs 1.40)

Change-Id: I253e0c373a2e0d45bbd25b1b6b816ac9d63c9077
This commit is contained in:
Umherirrender 2024-09-21 20:20:01 +02:00
parent 04542ebd46
commit ce2920a0d5

View file

@ -52,7 +52,7 @@ class AJAXPoll {
$input = trim( strip_tags( $input ) ); $input = trim( strip_tags( $input ) );
$lines = explode( "\n", trim( $input ) ); $lines = explode( "\n", trim( $input ) );
$dbw = wfGetDB( DB_PRIMARY ); $dbw = MediaWikiServices::getInstance()->getDBLoadBalancer()->getConnection( DB_PRIMARY );
/** /**
* Register poll in the database * Register poll in the database
@ -135,7 +135,7 @@ class AJAXPoll {
} }
private static function buildStats() { private static function buildStats() {
$dbr = wfGetDB( DB_REPLICA ); $dbr = MediaWikiServices::getInstance()->getDBLoadBalancer()->getConnection( DB_REPLICA );
$tab = $dbr->selectRow( $tab = $dbr->selectRow(
'ajaxpoll_vote', 'ajaxpoll_vote',
@ -198,7 +198,7 @@ During the last 48 hours, {$tab2->votes} votes have been given.";
return self::buildHTML( $id, $user, $readonly, '' ); return self::buildHTML( $id, $user, $readonly, '' );
} }
$dbw = wfGetDB( DB_PRIMARY ); $dbw = MediaWikiServices::getInstance()->getDBLoadBalancer()->getConnection( DB_PRIMARY );
if ( $answer != 0 ) { if ( $answer != 0 ) {
$answer = ++$answer; $answer = ++$answer;
@ -303,7 +303,7 @@ During the last 48 hours, {$tab2->votes} votes have been given.";
private static function buildHTML( $id, $user, $readonly, $lines = '', $extra_from_ajax = '' ) { private static function buildHTML( $id, $user, $readonly, $lines = '', $extra_from_ajax = '' ) {
global $wgTitle, $wgLang; global $wgTitle, $wgLang;
$dbr = wfGetDB( DB_REPLICA ); $dbr = MediaWikiServices::getInstance()->getDBLoadBalancer()->getConnection( DB_REPLICA );
$row = $dbr->selectRow( $row = $dbr->selectRow(
'ajaxpoll_info', 'ajaxpoll_info',