MarkAHershberger has submitted this change and it was merged.

Change subject: Installer: page refresh should refresh list of supported DBs
......................................................................


Installer: page refresh should refresh list of supported DBs

There's no need to cache _CompiledDBs's value from the first installer load.
Instead, the list should be regenerated on every page load, as it's merely being
used for displaying the user list of DBs to choose from.

This solves a common setup confusion, where user starts with no DB support, gets
a friendly error message, installs php5-mysql as requested, but refreshing the
page won't make the error go away.

Bug: 31533
Change-Id: I2e7e5b4f72e7c11706d491a205e202008e2511da
(cherry picked from commit ed542f41daf10f336a9d32107246dc7394ebfb12)
---
M includes/installer/Installer.php
M includes/installer/WebInstallerPage.php
2 files changed, 20 insertions(+), 11 deletions(-)

Approvals:
  MarkAHershberger: Verified; Looks good to me, approved



diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php
index 4d8e5f0..9fd67c9 100644
--- a/includes/installer/Installer.php
+++ b/includes/installer/Installer.php
@@ -46,6 +46,14 @@
         */
        protected $settings;
 
+
+       /**
+        * List of detected DBs, access using getCompiledDBs().
+        *
+        * @var array
+        */
+       protected $compiledDBs;
+
        /**
         * Cached DB installer instances, access using getDBInstaller().
         *
@@ -173,7 +181,6 @@
        protected $internalDefaults = array(
                '_UserLang' => 'en',
                '_Environment' => false,
-               '_CompiledDBs' => array(),
                '_SafeMode' => false,
                '_RaiseMemory' => false,
                '_UpgradeDone' => false,
@@ -368,7 +375,7 @@
                                }
                        }
                }
-               $this->setVar( '_CompiledDBs', $compiledDBs );
+               $this->compiledDBs = $compiledDBs;
 
                $this->parserTitle = Title::newFromText( 'Installer' );
                $this->parserOptions = new ParserOptions; // language will  be 
wrong :(
@@ -447,6 +454,15 @@
                } else {
                        return $this->settings[$name];
                }
+       }
+
+       /**
+        * Get a list of DBs supported by current PHP setup
+        *
+        * @return array
+        */
+       public function getCompiledDBs() {
+               return $this->compiledDBs;
        }
 
        /**
@@ -647,13 +663,7 @@
                        $allNames[] = wfMessage( "config-type-$name" )->text();
                }
 
-               // cache initially available databases to make sure that 
everything will be displayed correctly
-               // after a refresh on env checks page
-               $databases = $this->getVar( '_CompiledDBs-preFilter' );
-               if ( !$databases ) {
-                       $databases = $this->getVar( '_CompiledDBs' );
-                       $this->setVar( '_CompiledDBs-preFilter', $databases );
-               }
+               $databases = $this->getCompiledDBs();
 
                $databases = array_flip ( $databases );
                foreach ( array_keys( $databases ) as $db ) {
@@ -672,7 +682,6 @@
                        // @todo FIXME: This only works for the web installer!
                        return false;
                }
-               $this->setVar( '_CompiledDBs', $databases );
                return true;
        }
 
diff --git a/includes/installer/WebInstallerPage.php 
b/includes/installer/WebInstallerPage.php
index 7883029..06d16a5 100644
--- a/includes/installer/WebInstallerPage.php
+++ b/includes/installer/WebInstallerPage.php
@@ -462,7 +462,7 @@
 
                // 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' );
+               $compiledDBs = $this->parent->getCompiledDBs();
                if ( !in_array( $defaultType, $compiledDBs ) ) {
                        $defaultType = $compiledDBs[0];
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/76642
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2e7e5b4f72e7c11706d491a205e202008e2511da
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_21
Gerrit-Owner: MarkAHershberger <[email protected]>
Gerrit-Reviewer: MarkAHershberger <[email protected]>
Gerrit-Reviewer: Orenhe <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to