From: Tim Starling Date: Wed, 10 Feb 2016 10:32:38 +0000 (+1100) Subject: In Installer, set the context language early to avoid loading from User X-Git-Tag: 1.31.0-rc.0~8027^2 X-Git-Url: http://git.cyclocoop.org/%27%20.generer_url_ecrire%28_request%28%27exec%27%29%2C%27cmd=switch&outil=rss_couteau_suisse%27%29.%27?a=commitdiff_plain;h=1714299f7a01ea35ddb8f2e128f7bc1fdc009a32;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index 72907408ce..55ec8dfb7a 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -75,6 +75,7 @@ class CliInstaller extends Installer { $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 e61e2d2509..f7458c4605 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -361,6 +361,10 @@ abstract class Installer { 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 @@ abstract class Installer { } $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 31b201c4d2..75a93a3253 100644 --- a/mw-config/index.php +++ b/mw-config/index.php @@ -71,6 +71,7 @@ function wfInstallerMain() { $langCode = 'en'; } $wgLang = Language::factory( $langCode ); + RequestContext::getMain()->setLanguage( $wgLang ); $installer->setParserLanguage( $wgLang );