From 13c311bb0c12cff86f3b2cc6ffc47ff9571d31ee Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 3 Apr 2017 13:55:48 +1000 Subject: [PATCH] Fix two bugs in installer session error display If Installer::startSession() returns false, then showError() is called before setParserLanguage(), which causes DB access via Title::getContentModel(). The code which was meant to handle DB access from the parser did not do so, since the exception class which is thrown on attempted DB access has changed. Change-Id: I1478ec06a441851c5336bdde15734642615d45e9 --- includes/installer/Installer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index f03fe6a3f4..0a2b8084e2 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -446,6 +446,8 @@ abstract class Installer { $this->parserTitle = Title::newFromText( 'Installer' ); $this->parserOptions = new ParserOptions( $wgUser ); // language will be wrong :( $this->parserOptions->setEditSection( false ); + // Don't try to access DB before user language is initialised + $this->setParserLanguage( Language::factory( 'en' ) ); } /** @@ -674,7 +676,7 @@ abstract class Installer { try { $out = $wgParser->parse( $text, $this->parserTitle, $this->parserOptions, $lineStart ); $html = $out->getText(); - } catch ( DBAccessError $e ) { + } catch ( MediaWiki\Services\ServiceDisabledException $e ) { $html = ' ' . htmlspecialchars( $text ); if ( !empty( $this->debug ) ) { -- 2.20.1