Add database extension to LocalSettings.php.

Bug: T226857
Change-Id: Ifbcc8db4f96895fef76bdd747f3411536b9e6894
This commit is contained in:
Cindy Cicalese 2020-07-01 00:01:28 -04:00 committed by Cicalese
parent 95b5b72543
commit 16381261ae
3 changed files with 22 additions and 4 deletions

View file

@ -1862,4 +1862,18 @@ abstract class Installer {
set_time_limit( 0 );
Wikimedia\restoreWarnings();
}
/**
* Return the name of the extension selected to provide the database or null
* if the database is provided by core.
*
* @return string|null
*/
public function getUsedExtensionName() : ?string {
if ( empty( $this->settings['wgDBtype'] ) ) {
return null;
}
return $this->installerDbSupport
->getExtensionNameForDatabase( $this->settings['wgDBtype'] );
}
}

View file

@ -67,19 +67,19 @@ class InstallerDBSupport {
'installer' => MysqlInstaller::class,
'updater' => MysqlUpdater::class,
'driver' => DatabaseMysqli::class,
'extension' => 'core'
'extension' => null
],
'postgres' => [
'installer' => PostgresInstaller::class,
'updater' => PostgresUpdater::class,
'driver' => DatabasePostgres::class,
'extension' => 'core'
'extension' => null
],
'sqlite' => [
'installer' => SqliteInstaller::class,
'updater' => SqliteUpdater::class,
'driver' => DatabaseSqlite::class,
'extension' => 'core'
'extension' => null
]
];
@ -296,7 +296,7 @@ class InstallerDBSupport {
*/
public function getExtensionNameForDatabase(
string $database
): string {
): ?string {
if ( !isset( $this->databaseInfo[strtolower( $database )] ) ) {
throw new InvalidArgumentException( __METHOD__ .
" no registered database found for type '$database'" );

View file

@ -545,6 +545,10 @@ class WebInstallerOptions extends WebInstallerPage {
$extsToInstall[] = $ext;
}
}
$dbext = $this->parent->getUsedExtensionName();
if ( $dbext ) {
$extsToInstall[] = $dbext;
}
$this->parent->setVar( '_Extensions', $extsToInstall );
if ( $this->getVar( '_MainCacheType' ) == 'memcached' ) {