jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/370874 )
Change subject: Skip duplicate deprecated language codes in the language dropdown ...................................................................... Skip duplicate deprecated language codes in the language dropdown LanguageCode::getDeprecatedCodeMapping() is a very convenient function recently introduced in MW 1.29. This check is added at the end because we have to check the template existence first - if the wiki has e.g. a Template:Be-x-old, but not Template:Be-tarask, we don't want to hide the be-x-old. Bug: T172220 Change-Id: I71d266eee205d2201772e903cb0bcb06bf567b2f --- M UploadWizard.config.php 1 file changed, 10 insertions(+), 1 deletion(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified Jforrester: Looks good to me, but someone else must approve diff --git a/UploadWizard.config.php b/UploadWizard.config.php index 09cda85..79fc662 100644 --- a/UploadWizard.config.php +++ b/UploadWizard.config.php @@ -9,7 +9,8 @@ $userLangCode = $wgLang->getCode(); // We need to get a list of languages for the description dropdown. -$cacheKey = wfMemcKey( 'uploadwizard', 'language-templates', $userLangCode ); +// Increase the number below to invalidate the cache if this code changes. +$cacheKey = wfMemcKey( 'uploadwizard', 'language-templates2', $userLangCode ); // Try to get a cached version of the list $uwLanguages = $wgMemc->get( $cacheKey ); // Commons only: ISO 646 code of Tagalog is 'tl', but language template is 'tgl' @@ -54,6 +55,14 @@ } } } + + // Skip the duplicate deprecated language codes if the new one is okay to use. + foreach ( LanguageCode::getDeprecatedCodeMapping() as $oldKey => $newKey ) { + if ( isset( $uwLanguages[$newKey] ) && isset( $uwLanguages[$oldKey] ) ) { + unset( $uwLanguages[$oldKey] ); + } + } + // Sort the list by the language name natcasesort( $uwLanguages ); // Cache the list for 1 day -- To view, visit https://gerrit.wikimedia.org/r/370874 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I71d266eee205d2201772e903cb0bcb06bf567b2f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/UploadWizard Gerrit-Branch: master Gerrit-Owner: Bartosz DziewoĆski <matma....@gmail.com> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: Matthias Mullie <mmul...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits