protected static $dbTypes = [
'mysql',
'postgres',
- 'oracle',
- 'mssql',
'sqlite',
];
*/
protected function envCheckDB() {
global $wgLang;
+ /** @var string|null $dbType The user-specified database type */
+ $dbType = $this->getVar( 'wgDBtype' );
$allNames = [];
$databases = $this->getCompiledDBs();
$databases = array_flip( $databases );
+ $ok = true;
foreach ( array_keys( $databases ) as $db ) {
$installer = $this->getDBInstaller( $db );
$status = $installer->checkPrerequisites();
if ( !$status->isGood() ) {
+ if ( !$this instanceof WebInstaller && $db === $dbType ) {
+ // Strictly check the key database type instead of just outputting message
+ // Note: No perform this check run from the web installer, since this method always called by
+ // the welcome page under web installation, so $dbType will always be 'mysql'
+ $ok = false;
+ }
$this->showStatusMessage( $status );
- }
- if ( !$status->isOK() ) {
unset( $databases[$db] );
}
}
$databases = array_flip( $databases );
if ( !$databases ) {
$this->showError( 'config-no-db', $wgLang->commaList( $allNames ), count( $allNames ) );
-
- // @todo FIXME: This only works for the web installer!
return false;
}
-
- return true;
+ return $ok;
}
/**
* @param callable $startCB A callback array for the beginning of each step
* @param callable $endCB A callback array for the end of each step
*
- * @return array Array of Status objects
+ * @return Status[] Array of Status objects
*/
public function performInstallation( $startCB, $endCB ) {
$installResults = [];
public static function overrideConfig() {
// Use PHP's built-in session handling, since MediaWiki's
// SessionHandler can't work before we have an object cache set up.
- define( 'MW_NO_SESSION_HANDLER', 1 );
+ if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
+ define( 'MW_NO_SESSION_HANDLER', 1 );
+ }
// Don't access the database
$GLOBALS['wgUseDatabaseMessages'] = false;