Don't check for each database's availability twice. This halves the number of ugly...
authorMax Semenik <maxsem@users.mediawiki.org>
Fri, 19 Aug 2011 18:27:35 +0000 (18:27 +0000)
committerMax Semenik <maxsem@users.mediawiki.org>
Fri, 19 Aug 2011 18:27:35 +0000 (18:27 +0000)
includes/installer/Installer.php

index 3544753..a25a94d 100644 (file)
@@ -333,12 +333,14 @@ abstract class Installer {
                        $this->settings[$var] = $GLOBALS[$var];
                }
 
+               $compiledDBs = array();
                foreach ( self::getDBTypes() as $type ) {
                        $installer = $this->getDBInstaller( $type );
 
                        if ( !$installer->isCompiled() ) {
                                continue;
                        }
+                       $compiledDBs[] = $type;
 
                        $defaults = $installer->getGlobalDefaults();
 
@@ -350,6 +352,7 @@ abstract class Installer {
                                }
                        }
                }
+               $this->setVar( '_CompiledDBs', $compiledDBs );
 
                $this->parserTitle = Title::newFromText( 'Installer' );
                $this->parserOptions = new ParserOptions; // language will  be wrong :(
@@ -622,19 +625,13 @@ abstract class Installer {
        protected function envCheckDB() {
                global $wgLang;
 
-               $compiledDBs = array();
                $allNames = array();
 
                foreach ( self::getDBTypes() as $name ) {
-                       if ( $this->getDBInstaller( $name )->isCompiled() ) {
-                               $compiledDBs[] = $name;
-                       }
-                       $allNames[] = wfMsg( 'config-type-' . $name );
+                       $allNames[] = wfMsg( "config-type-$name" );
                }
 
-               $this->setVar( '_CompiledDBs', $compiledDBs );
-
-               if ( !$compiledDBs ) {
+               if ( !$this->getVar( '_CompiledDBs' ) ) {
                        $this->showError( 'config-no-db', $wgLang->commaList( $allNames ) );
                        // @todo FIXME: This only works for the web installer!
                        return false;