Installer: output css correctly when session errors occur
authorSergio Santoro <santoro.srg@gmail.com>
Sun, 4 May 2014 10:43:28 +0000 (12:43 +0200)
committerSergio Santoro <santoro.srg@gmail.com>
Sun, 4 May 2014 10:43:28 +0000 (12:43 +0200)
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

includes/installer/WebInstaller.php
mw-config/index.php

index d897507..34d919d 100644 (file)
@@ -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;
+       }
+
 }
index fc7eadb..d22454f 100644 (file)
@@ -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;
        }