Merge "Web installer: always autoselect some DB type"
authorMarkAHershberger <mhershberger@wikimedia.org>
Sat, 27 Apr 2013 16:30:00 +0000 (16:30 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 27 Apr 2013 16:30:00 +0000 (16:30 +0000)
RELEASE-NOTES-1.21
includes/installer/WebInstallerPage.php

index 1930636..f71f1ef 100644 (file)
@@ -210,6 +210,8 @@ production.
 * (bug 45143) jquery.badge: Treat non-Latin variants of zero as zero as well.
 * (bug 46151) mwdocgen.php should not ignore exit code of doxygen command.
 * (bug 41889) Fix $.tablesorter rowspan exploding for complex cases.
+* (bug 47489) Installer now automatically selects the next-best database type if
+  the PHP mysql extension is not loaded, preventing fatal errors in some cases.
 
 === API changes in 1.21 ===
 * prop=revisions can now report the contentmodel and contentformat.
index b640fb8..382288c 100644 (file)
@@ -467,7 +467,14 @@ class WebInstaller_DBConnect extends WebInstallerPage {
                $this->addHTML( $this->parent->getInfoBox(
                        wfMessage( 'config-support-info', trim( $dbSupport ) )->text() ) );
 
-               foreach ( $this->parent->getVar( '_CompiledDBs' ) as $type ) {
+               // It's possible that the library for the default DB type is not compiled in.
+               // In that case, instead select the first supported DB type in the list.
+               $compiledDBs = $this->parent->getVar( '_CompiledDBs' );
+               if ( !in_array( $defaultType, $compiledDBs ) ) {
+                       $defaultType = $compiledDBs[0];
+               }
+
+               foreach ( $compiledDBs as $type ) {
                        $installer = $this->parent->getDBInstaller( $type );
                        $types .=
                                '<li>' .
@@ -503,6 +510,9 @@ class WebInstaller_DBConnect extends WebInstallerPage {
        public function submit() {
                $r = $this->parent->request;
                $type = $r->getVal( 'DBType' );
+               if ( !$type ) {
+                       return Status::newFatal( 'config-invalid-db-type' );
+               }
                $this->setVar( 'wgDBtype', $type );
                $installer = $this->parent->getDBInstaller( $type );
                if ( !$installer ) {