X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSetup.php;h=aba050d6e37bfaf3ad517e3bead5301d91423de3;hb=0a2ac54ba3885d4841e123d10d6daf39195664b4;hp=43bc2d8de3d84d44af363346aa40539380240a6a;hpb=1dee28cb5f1efd6d9e14d6cc1d0c73c3f69269b4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Setup.php b/includes/Setup.php index 43bc2d8de3..aba050d6e3 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -35,6 +35,14 @@ if ( !defined( 'MEDIAWIKI' ) ) { exit( 1 ); } +// Check to see if we are at the file scope +$wgScopeTest = 'MediaWiki Setup.php scope test'; +if ( !isset( $GLOBALS['wgScopeTest'] ) || $GLOBALS['wgScopeTest'] !== $wgScopeTest ) { + echo "Error, Setup.php must be included from the file scope.\n"; + die( 1 ); +} +unset( $wgScopeTest ); + /** * Pre-config setup: Before loading LocalSettings.php */ @@ -118,12 +126,6 @@ ExtensionRegistry::getInstance()->loadFromQueue(); // Don't let any other extensions load ExtensionRegistry::getInstance()->finish(); -// Check to see if we are at the file scope -if ( !isset( $wgVersion ) ) { - echo "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n"; - die( 1 ); -} - mb_internal_encoding( 'UTF-8' ); // Set the configured locale on all requests for consisteny @@ -496,11 +498,24 @@ if ( is_array( $wgExtraNamespaces ) ) { $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces; } +// Hard-deprecate setting $wgDummyLanguageCodes in LocalSettings.php +if ( count( $wgDummyLanguageCodes ) !== 0 ) { + wfDeprecated( '$wgDummyLanguageCodes', '1.29' ); +} // Merge in the legacy language codes, incorporating overrides from the config $wgDummyLanguageCodes += [ + // Internal language codes of the private-use area which get mapped to + // themselves. 'qqq' => 'qqq', // Used for message documentation 'qqx' => 'qqx', // Used for viewing message keys ] + $wgExtraLanguageCodes + LanguageCode::getDeprecatedCodeMapping(); +// Merge in (inverted) BCP 47 mappings +foreach ( LanguageCode::getNonstandardLanguageCodeMapping() as $code => $bcp47 ) { + $bcp47 = strtolower( $bcp47 ); // force case-insensitivity + if ( !isset( $wgDummyLanguageCodes[$bcp47] ) ) { + $wgDummyLanguageCodes[$bcp47] = $wgDummyLanguageCodes[$code] ?? $code; + } +} // These are now the same, always // To determine the user language, use $wgLang->getCode()