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
*/
* Load LocalSettings.php
*/
-if ( is_readable( "$IP/StartProfiler.php" ) ) {
- // @deprecated since 1.32: Use LocalSettings.php instead.
- require "$IP/StartProfiler.php";
-}
-
if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
call_user_func( MW_CONFIG_CALLBACK );
} else {
// 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
];
/**
- * Initialise $wgLocalFileRepo from backwards-compatible settings
+ * Shortcuts for $wgLocalFileRepo
*/
if ( !$wgLocalFileRepo ) {
$wgLocalFileRepo = [
'deletedHashLevels' => $wgHashedUploadDirectory ? 3 : 0
];
}
+
+if ( !isset( $wgLocalFileRepo['backend'] ) ) {
+ // Create a default FileBackend name.
+ // FileBackendGroup will register a default, if absent from $wgFileBackends.
+ $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
+}
+
/**
- * Initialise shared repo from backwards-compatible settings
+ * Shortcuts for $wgForeignFileRepos
*/
if ( $wgUseSharedUploads ) {
if ( $wgSharedUploadDBname ) {
'apiThumbCacheExpiry' => 0,
];
}
-/*
- * Add on default file backend config for file repos.
- * FileBackendGroup will handle initializing the backends.
- */
-if ( !isset( $wgLocalFileRepo['backend'] ) ) {
- $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
-}
foreach ( $wgForeignFileRepos as &$repo ) {
if ( !isset( $repo['directory'] ) && $repo['class'] === ForeignAPIRepo::class ) {
$repo['directory'] = $wgUploadDirectory; // b/c
$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()
wfDebug( $debug );
}
-$wgMemc = wfGetMainCache();
+$wgMemc = ObjectCache::getLocalClusterInstance();
$messageMemc = wfGetMessageCacheStorage();
wfDebugLog( 'caches',
/**
* @var Language $wgContLang
+ * @deprecated since 1.32, use the ContentLanguage service directly
*/
-$wgContLang = Language::factory( $wgLanguageCode );
-$wgContLang->initContLang();
+$wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
// Now that variant lists may be available...
$wgRequest->interpolateTitle();
if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
// If session.auto_start is there, we can't touch session name
if ( $wgPHPSessionHandling !== 'disable' && !wfIniGetBool( 'session.auto_start' ) ) {
- session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
+ session_name( $wgSessionName ?: $wgCookiePrefix . '_session' );
}
// Create the SessionManager singleton and set up our session handler,
/**
* @var Parser $wgParser
+ * @deprecated since 1.32, use MediaWikiServices::getParser() instead
*/
$wgParser = new StubObject( 'wgParser', function () {
return MediaWikiServices::getInstance()->getParser();