Merge "Upgrade premature implicit transaction commits to exceptions"
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderStartUpModule.php
index d765137..eb9788c 100644 (file)
@@ -40,8 +40,17 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                }
 
                global $wgContLang;
+               $conf = $this->getConfig();
 
-               $mainPage = Title::newMainPage();
+               // We can't use Title::newMainPage() if 'mainpage' is in
+               // $wgForceUIMsgAsContentMsg because that will try to use the session
+               // user's language and we have no session user. This does the
+               // equivalent but falling back to our ResourceLoaderContext language
+               // instead.
+               $mainPage = Title::newFromText( $context->msg( 'mainpage' )->inContentLanguage()->text() );
+               if ( !$mainPage ) {
+                       $mainPage = Title::newFromText( 'Main Page' );
+               }
 
                /**
                 * Namespace related preparation
@@ -57,7 +66,8 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        }
                }
 
-               $conf = $this->getConfig();
+               $illegalFileChars = $conf->get( 'IllegalFileChars' );
+
                // Build list of variables
                $vars = [
                        'wgLoadScript' => wfScript( 'load' ),
@@ -99,6 +109,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        'wgResourceLoaderMaxQueryLength' => $conf->get( 'ResourceLoaderMaxQueryLength' ),
                        'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces,
                        'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass( Title::legalChars() ),
+                       'wgIllegalFileChars' => Title::convertByteClassToUnicodeClass( $illegalFileChars ),
                        'wgResourceLoaderStorageVersion' => $conf->get( 'ResourceLoaderStorageVersion' ),
                        'wgResourceLoaderStorageEnabled' => $conf->get( 'ResourceLoaderStorageEnabled' ),
                        'wgResourceLoaderLegacyModules' => self::getLegacyModules(),
@@ -209,7 +220,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        }
 
                        $versionHash = $module->getVersionHash( $context );
-                       if ( strlen( $versionHash ) !== 8 ) {
+                       if ( strlen( $versionHash ) !== 7 ) {
                                $context->getLogger()->warning(
                                        "Module '{module}' produced an invalid version hash: '{version}'.",
                                        [