From: Sergio Santoro Date: Sun, 4 May 2014 10:43:28 +0000 (+0200) Subject: Installer: output css correctly when session errors occur X-Git-Tag: 1.31.0-rc.0~15571^2 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=1e9064483d41c8e7733e9189208a5c8ac3404e13;p=lhc%2Fweb%2Fwiklou.git Installer: output css correctly when session errors occur CSS was not showing correctly when session errors occurred. This was caused because mw-config/index.php was not taking into account the "css" parameter passed in the URL. Change-Id: I500c7340ab6826d428e9e3be28bcfc7ca5ed8466 --- diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index d8975073c7..34d919d51f 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -182,10 +182,7 @@ class WebInstaller extends Installer { $cssDir = $this->request->getVal( 'css' ); if ( $cssDir ) { - $cssDir = ( $cssDir == 'rtl' ? 'rtl' : 'ltr' ); - $this->request->response()->header( 'Content-type: text/css' ); - echo $this->output->getCSS( $cssDir ); - + $this->outputCss( $cssDir ); return $this->session; } @@ -354,8 +351,6 @@ class WebInstaller extends Installer { restore_error_handler(); if ( $this->phpErrors ) { - $this->showError( 'config-session-error', $this->phpErrors[0] ); - return false; } @@ -1161,4 +1156,20 @@ class WebInstaller extends Installer { return WebRequest::detectServer(); } + /** + * @param string $dir CSS direction ( rtl or ltr ) + */ + public function outputCss( $dir ) { + $dir = ( $dir == 'rtl' ? 'rtl' : 'ltr' ); + $this->request->response()->header( 'Content-type: text/css' ); + echo $this->output->getCSS( $dir ); + } + + /** + * @return string[] + */ + public function getPhpErrors() { + return $this->phpErrors; + } + } diff --git a/mw-config/index.php b/mw-config/index.php index fc7eadb5a4..d22454f841 100644 --- a/mw-config/index.php +++ b/mw-config/index.php @@ -36,6 +36,16 @@ function wfInstallerMain() { $installer = InstallerOverrides::getWebInstaller( $wgRequest ); if ( !$installer->startSession() ) { + + if( $installer->request->getVal( "css" ) ) { + // Do not display errors on css pages + $cssDir = $installer->request->getVal( "css" ); + $installer->outputCss( $cssDir ); + exit; + } + + $errors = $installer->getPhpErrors(); + $installer->showError( 'config-session-error', $errors[0] ); $installer->finish(); exit; }