Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/272816

Change subject: In Installer, set the context language early to avoid loading 
from User
......................................................................

In Installer, set the context language early to avoid loading from User

Set the context language early, even before the session is loaded, to
avoid attempting to call User::loadFromSession(). Also update the things
that set $wgLang to also set it in RequestContext.

Passing $wgUser through to the ParserOptions constructor isn't strictly
necessary right now, but it does at least show the intended data flow
and is more robust to future changes in the way the language is passed
through to ParserOptions.

Fixes bug T126177 independently of my other two patches.

Bug: T126177
Change-Id: I15eb9cdce7805382d96b6fc6ffb9b25855876417
(cherry-picked from 1714299f7a01ea35ddb8f2e128f7bc1fdc009a32)
---
M includes/installer/CliInstaller.php
M includes/installer/Installer.php
M mw-config/index.php
3 files changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/16/272816/1

diff --git a/includes/installer/CliInstaller.php 
b/includes/installer/CliInstaller.php
index 7290740..55ec8df 100644
--- a/includes/installer/CliInstaller.php
+++ b/includes/installer/CliInstaller.php
@@ -75,6 +75,7 @@
                        $wgContLang = Language::factory( $option['lang'] );
                        $wgLang = Language::factory( $option['lang'] );
                        $wgLanguageCode = $option['lang'];
+                       RequestContext::getMain()->setLanguage( $wgLang );
                }
 
                $this->setVar( 'wgSitename', $siteName );
diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php
index e61e2d2..f7458c4 100644
--- a/includes/installer/Installer.php
+++ b/includes/installer/Installer.php
@@ -361,6 +361,10 @@
        public function __construct() {
                global $wgMessagesDirs, $wgUser;
 
+               // Don't attempt to load user language options (T126177)
+               // This will be overridden in the web installer with the 
user-specified language
+               RequestContext::getMain()->setLanguage( 'en' );
+
                // Disable the i18n cache
                Language::getLocalisationCache()->disableBackend();
                // Disable LoadBalancer and wfGetDB etc.
@@ -405,7 +409,7 @@
                }
 
                $this->parserTitle = Title::newFromText( 'Installer' );
-               $this->parserOptions = new ParserOptions; // language will be 
wrong :(
+               $this->parserOptions = new ParserOptions( $wgUser ); // 
language will be wrong :(
                $this->parserOptions->setEditSection( false );
        }
 
diff --git a/mw-config/index.php b/mw-config/index.php
index 31b201c..75a93a3 100644
--- a/mw-config/index.php
+++ b/mw-config/index.php
@@ -71,6 +71,7 @@
                $langCode = 'en';
        }
        $wgLang = Language::factory( $langCode );
+       RequestContext::getMain()->setLanguage( $wgLang );
 
        $installer->setParserLanguage( $wgLang );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/272816
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I15eb9cdce7805382d96b6fc6ffb9b25855876417
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.13
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to