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
---
M includes/installer/Installer.php
M includes/installer/WebInstallerPage.php
2 files changed, 20 insertions(+), 11 deletions(-)
Approvals:
Parent5446: Looks good to me, but someone else must approve
Freakolowsky: Looks good to me, but someone else must approve
MarkAHershberger: Verified; Looks good to me, approved
jenkins-bot: Checked
diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php
index b1517e4..169e89c 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().
*
@@ -175,7 +183,6 @@
protected $internalDefaults = array(
'_UserLang' => 'en',
'_Environment' => false,
- '_CompiledDBs' => array(),
'_SafeMode' => false,
'_RaiseMemory' => false,
'_UpgradeDone' => false,
@@ -370,7 +377,7 @@
}
}
}
- $this->setVar( '_CompiledDBs', $compiledDBs );
+ $this->compiledDBs = $compiledDBs;
$this->parserTitle = Title::newFromText( 'Installer' );
$this->parserOptions = new ParserOptions; // language will be
wrong :(
@@ -449,6 +456,15 @@
} else {
return $this->settings[$name];
}
+ }
+
+ /**
+ * Get a list of DBs supported by current PHP setup
+ *
+ * @return array
+ */
+ public function getCompiledDBs() {
+ return $this->compiledDBs;
}
/**
@@ -651,13 +667,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 ) {
@@ -676,7 +686,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 8a9fc2d..4a57260 100644
--- a/includes/installer/WebInstallerPage.php
+++ b/includes/installer/WebInstallerPage.php
@@ -469,7 +469,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/65427
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: master
Gerrit-Owner: Orenhe <[email protected]>
Gerrit-Reviewer: Freakolowsky <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: MarkAHershberger <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Waldir <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits