From e4432c18b2c7abac8d672eefaf3a4b0106c09978 Mon Sep 17 00:00:00 2001 From: hslater Date: Wed, 5 Mar 2025 20:07:45 +1300 Subject: [PATCH] Replace deprecated wfGetDB Prevents PHP Deprecated: Use of wfGetDB was deprecated in MediaWiki 1.39 when running update.php Compatible with MW 1.35.0 --- includes/Targets.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/Targets.php b/includes/Targets.php index cf62205..065568f 100644 --- a/includes/Targets.php +++ b/includes/Targets.php @@ -24,6 +24,8 @@ */ namespace LinkTitles; +use MediaWiki\MediaWikiServices; + /** * Fetches potential target page titles from the database. */ @@ -135,7 +137,7 @@ class Targets { // shortest to longest. Only titles from 'normal' pages (namespace uid // = 0) are returned. Since the db may be sqlite, we need a try..catch // structure because sqlite does not support the CHAR_LENGTH function. - $dbr = wfGetDB( DB_REPLICA ); + $dbr = MediaWikiServices::getInstance()->getDBLoadBalancer()->getConnection( DB_REPLICA ); $this->queryResult = $dbr->select( 'page', array( 'page_title', 'page_namespace' , "weight" => $weightSelect),