Fix two bugs in installer session error display
authorTim Starling <tstarling@wikimedia.org>
Mon, 3 Apr 2017 03:55:48 +0000 (13:55 +1000)
committerTim Starling <tstarling@wikimedia.org>
Mon, 3 Apr 2017 03:55:48 +0000 (13:55 +1000)
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

index f03fe6a..0a2b808 100644 (file)
@@ -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 = '<!--DB access attempted during parse-->  ' . htmlspecialchars( $text );
 
                        if ( !empty( $this->debug ) ) {