Page MenuHomePhabricator

Compatibility with MW 1.43: PageForms: Use of wfGetDB was deprecated in MediaWiki 1.39
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Install PageForms 5.8.1 on MW 1.43
  • Run update.php script

What happens?:

The following deprecated error occured:

PHP Deprecated:  Use of wfGetDB was deprecated in MediaWiki 1.39. [Called from PFValuesUtils::getCategoriesForPage in /var/www/html/extensions/PageForms/includes/PF_ValuesUtils.php at line 64] in /var/www/html/includes/debug/MWDebug.php on line 385

What should have happened instead?:

No errors should occur.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

MediaWiki 1.43.1
PageForms 5.8.1

Other information (browser name/version, screenshots, etc.):

Event Timeline

Purposed solution: replace the line 64 of PageForms/includes/PF_ValuesUtils.php

		$db = wfGetDB( DB_REPLICA );

with

		$loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer();
		$db = $loadBalancer->getConnection( DB_REPLICA );

You are welcome to post that patch on Gerrit for review if you want to: https://www.mediawiki.org/wiki/Gerrit/Tutorial

(Personal opinion of no consequence: deprecating and removing wfGetDB was a mistake as it lead to entirely predictable churn and breakage. But whatever)

That's a rather old version of Page Forms - you should upgrade to the latest version.

S0ring claimed this task.

I've downloaded the version for 1.43 using the ExtensionDistributor [1] and thus I got PageForms v.5.8.1.

If I download the master version fron Github [2] then I get v.6.0.

Indeed in 6.0 wfGetDB has disappeared.

[1] https://www.mediawiki.org/wiki/Special:ExtensionDistributor/PageForms
[2] https://github.com/wikimedia/mediawiki-extensions-PageForms