From 583764482a0a8d2b7a191a541495d14c24880eaf Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sun, 11 Jan 2015 19:30:43 +0100 Subject: [PATCH] DatabaseInstaller::getGlobalDefaults: Return all needed globals Since Id364306d883e0d494b948854e05f3f79ba7dd6d2 the text boxes on the gui installer were not preloaded with the default values from DefaultSettings.php. Changed this by return all needed globals (defined by getGlobalNames) from DatabaseInstaller::getGlobalDefaults(). This injects the as default value in function getVar and than gets used, when no value is set. Bug: T71281 Change-Id: I8217b25e903e40ec82be3d700381ff7aea3b481f --- includes/installer/DatabaseInstaller.php | 11 ++++++++--- includes/installer/MssqlInstaller.php | 4 ++-- includes/installer/MysqlInstaller.php | 7 ------- includes/installer/PostgresInstaller.php | 4 ++-- includes/installer/SqliteInstaller.php | 6 +++--- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 1c15ad0fbb..6ccf2d55d3 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -369,12 +369,17 @@ abstract class DatabaseInstaller { } /** - * Get a name=>value map of MW configuration globals that overrides. - * DefaultSettings.php + * Get a name=>value map of MW configuration globals for the default values. * @return array */ public function getGlobalDefaults() { - return array(); + $defaults = array(); + foreach ( $this->getGlobalNames() as $var ) { + if ( isset( $GLOBALS[$var] ) ) { + $defaults[$var] = $GLOBALS[$var]; + } + } + return $defaults; } /** diff --git a/includes/installer/MssqlInstaller.php b/includes/installer/MssqlInstaller.php index 46bb86c010..5a8403f552 100644 --- a/includes/installer/MssqlInstaller.php +++ b/includes/installer/MssqlInstaller.php @@ -652,9 +652,9 @@ class MssqlInstaller extends DatabaseInstaller { public function getGlobalDefaults() { // The default $wgDBmwschema is null, which breaks Postgres and other DBMSes that require // the use of a schema, so we need to set it here - return array( + return array_merge( parent::getGlobalDefaults(), array( 'wgDBmwschema' => 'mediawiki', - ); + ) ); } /** diff --git a/includes/installer/MysqlInstaller.php b/includes/installer/MysqlInstaller.php index b82e611414..63e8611c2b 100644 --- a/includes/installer/MysqlInstaller.php +++ b/includes/installer/MysqlInstaller.php @@ -71,13 +71,6 @@ class MysqlInstaller extends DatabaseInstaller { return self::checkExtension( 'mysql' ) || self::checkExtension( 'mysqli' ); } - /** - * @return array - */ - public function getGlobalDefaults() { - return array(); - } - /** * @return string */ diff --git a/includes/installer/PostgresInstaller.php b/includes/installer/PostgresInstaller.php index c30a989e6e..e19f9aafc3 100644 --- a/includes/installer/PostgresInstaller.php +++ b/includes/installer/PostgresInstaller.php @@ -627,9 +627,9 @@ class PostgresInstaller extends DatabaseInstaller { public function getGlobalDefaults() { // The default $wgDBmwschema is null, which breaks Postgres and other DBMSes that require // the use of a schema, so we need to set it here - return array( + return array_merge( parent::getGlobalDefaults(), array( 'wgDBmwschema' => 'mediawiki', - ); + ) ); } public function setupPLpgSQL() { diff --git a/includes/installer/SqliteInstaller.php b/includes/installer/SqliteInstaller.php index 351b022329..cfd891512d 100644 --- a/includes/installer/SqliteInstaller.php +++ b/includes/installer/SqliteInstaller.php @@ -68,6 +68,7 @@ class SqliteInstaller extends DatabaseInstaller { } public function getGlobalDefaults() { + $defaults = parent::getGlobalDefaults(); if ( isset( $_SERVER['DOCUMENT_ROOT'] ) ) { $path = str_replace( array( '/', '\\' ), @@ -75,10 +76,9 @@ class SqliteInstaller extends DatabaseInstaller { dirname( $_SERVER['DOCUMENT_ROOT'] ) . '/data' ); - return array( 'wgSQLiteDataDir' => $path ); - } else { - return array(); + $defaults['wgSQLiteDataDir'] = $path; } + return $defaults; } public function getConnectForm() { -- 2.20.1