Page MenuHomePhabricator

Use of wfBCP47 was deprecated in MediaWiki 1.31. [Called from PageTranslationHooks::formatLanguageLink
Closed, ResolvedPublic

Description

PHP Deprecated: Use of wfBCP47 was deprecated in MediaWiki 1.31. [Called from PageTranslationHooks::formatLanguageLink in /www/dev.translatewiki.net/docroot/w/extensions/Translate/tag/PageTranslationHooks.php at line 557] in /www/dev.translatewiki.net/docroot/w/includes/debug/MWDebug.php on line 309

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 3 2018, 9:29 AM
Nikerabbit triaged this task as Low priority.
Nikerabbit moved this task from Backlog to Translate twn on the User-Nikerabbit board.
abi_ moved this task from Backlog to In Progress on the User-abi_ board.Mar 4 2019, 5:21 AM
abi_ closed this task as Resolved.Mar 4 2019, 5:53 AM
abi_ claimed this task.
abi_ added a subscriber: abi_.

@Nikerabbit - The patch above has been abandoned. I believe that since the translate extension needs to support MediaWiki - 1.29 and above, we will need to add conditionals in addition to what's done in the previous patch.

I'd like to add a method to TranslateUtils called bcp47 which will check the version of MediaWiki and then use the appropriate method. This will be important in-case the global function wfBCP47 is removed in the future version.

Version checking will be done using,

global $wgVersion;
version_compare( $wgVersion, '1.31', '<' );
abi_ reopened this task as Open.Mar 4 2019, 5:53 AM
abi_ moved this task from In Progress to Backlog on the User-abi_ board.Mar 4 2019, 6:29 AM

Minimum version of MediaWiki core that needs to be supported by MLEB extensions is now 1.31. Hence I think no versions checks are needed anymore (and if they are needed, I prefer is_callable( new method ).

abi_ added a comment.EditedMar 4 2019, 7:35 AM

OK, I was checking the MediaWiki version listed on the page here,

I will restore and review the patch, and also update the version on that Wiki page.

I prefer `is_callable( new method )`.

I agree, that would be a better approach.

abi_ moved this task from Backlog to In Progress on the User-abi_ board.Mar 4 2019, 9:34 AM

Change 494208 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Replaces usage of wfBCP47 with LanguageCode::bcp47

https://gerrit.wikimedia.org/r/494208

abi_ moved this task from In Progress to Under Review on the User-abi_ board.Mar 4 2019, 1:08 PM

I reviewed the previous patch, and noticed that wrapper code was already added to the extension in this patch. Hence decided to abandon the previous patch mentioned here.

I've removed the wrapper added in TranslateUtils with direct calls to LanguageCode::bcp47 since we no longer need to maintain backward compatibility with MediaWiki versions < 1.31.

Testing

To test this I performed the following actions,

  1. Login
  2. Marking a new page for translation.
  3. Translating the translation units.
  4. Running the test cases under Translate extension tests folder.

All of the above worked as expected.

I've also updated the minimum version mentioned here.

Change 494208 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Replaces usage of wfBCP47 with LanguageCode::bcp47

https://gerrit.wikimedia.org/r/494208

abi_ moved this task from Under Review to QA on the User-abi_ board.

Moved to QA.

Nikerabbit moved this task from QA to Done on the User-abi_ board.Tue, May 7, 8:26 AM

I have verified this with code search and testing.

Nikerabbit closed this task as Resolved.Tue, May 21, 7:48 AM