Merge "Replace deprecated Language::fetchLanguageName"

This commit is contained in:
jenkins-bot 2022-12-29 18:08:09 +00:00 committed by Gerrit Code Review
commit 394d761a34
2 changed files with 6 additions and 7 deletions

View file

@ -3,7 +3,6 @@
namespace MediaWiki\Extension\Interwiki;
use Hooks as MWHooks;
use Language;
use MediaWiki\MediaWikiServices;
use WikiMap;
@ -60,7 +59,7 @@ class Hooks {
public static function onInterwikiLoadPrefix( $prefix, &$iwData ) {
global $wgInterwikiCentralDB, $wgInterwikiCentralInterlanguageDB;
$isInterlanguageLink = Language::fetchLanguageName( $prefix );
$isInterlanguageLink = MediaWikiServices::getInstance()->getLanguageNameUtils()->getLanguageName( $prefix );
if ( !$isInterlanguageLink && !self::$shouldSkipIWCheck ) {
// Check if prefix exists locally and skip
$lookup = MediaWikiServices::getInstance()->getInterwikiLookup();

View file

@ -4,7 +4,6 @@ namespace MediaWiki\Extension\Interwiki;
use Html;
use HTMLForm;
use Language;
use LogPage;
use MediaWiki\MediaWikiServices;
use OutputPage;
@ -252,7 +251,7 @@ class SpecialInterwiki extends SpecialPage {
// Disallow adding local interlanguage definitions if using global
$interwikiCentralInterlanguageDB = $config->get( 'InterwikiCentralInterlanguageDB' );
if (
$do === 'add' && Language::fetchLanguageName( $prefix )
$do === 'add' && MediaWikiServices::getInstance()->getLanguageNameUtils()->getLanguageName( $prefix )
&& $interwikiCentralInterlanguageDB !== WikiMap::getCurrentWikiId()
&& $interwikiCentralInterlanguageDB !== null
) {
@ -352,6 +351,7 @@ class SpecialInterwiki extends SpecialPage {
$iwGlobalLanguagePrefixes = [];
$config = $this->getConfig();
$interwikiCentralDB = $config->get( 'InterwikiCentralDB' );
$languageNameUtils = MediaWikiServices::getInstance()->getLanguageNameUtils();
if ( $interwikiCentralDB !== null && $interwikiCentralDB !== WikiMap::getCurrentWikiId() ) {
// Fetch list from global table
$dbrCentralDB = wfGetDB( DB_REPLICA, [], $interwikiCentralDB );
@ -359,7 +359,7 @@ class SpecialInterwiki extends SpecialPage {
$retval = [];
foreach ( $res as $row ) {
$row = (array)$row;
if ( !Language::fetchLanguageName( $row['iw_prefix'] ) ) {
if ( !$languageNameUtils->getLanguageName( $row['iw_prefix'] ) ) {
$retval[] = $row;
}
}
@ -381,7 +381,7 @@ class SpecialInterwiki extends SpecialPage {
$row = (array)$row;
// Note that the above DB query explicitly *excludes* interlang ones
// (which makes sense), whereas here we _only_ care about interlang ones!
if ( Language::fetchLanguageName( $row['iw_prefix'] ) ) {
if ( $languageNameUtils->getLanguageName( $row['iw_prefix'] ) ) {
$retval2[] = $row;
}
}
@ -392,7 +392,7 @@ class SpecialInterwiki extends SpecialPage {
$iwLocalPrefixes = [];
$iwLanguagePrefixes = [];
foreach ( $iwPrefixes as $iwPrefix ) {
if ( Language::fetchLanguageName( $iwPrefix['iw_prefix'] ) ) {
if ( $languageNameUtils->getLanguageName( $iwPrefix['iw_prefix'] ) ) {
$iwLanguagePrefixes[] = $iwPrefix;
} else {
$iwLocalPrefixes[] = $iwPrefix;