Umherirrender has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/184243

Change subject: DatabaseInstaller::getGlobalDefaults: Return all needed globals
......................................................................

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
---
M includes/installer/DatabaseInstaller.php
M includes/installer/MssqlInstaller.php
M includes/installer/MysqlInstaller.php
M includes/installer/PostgresInstaller.php
M includes/installer/SqliteInstaller.php
5 files changed, 15 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/43/184243/1

diff --git a/includes/installer/DatabaseInstaller.php 
b/includes/installer/DatabaseInstaller.php
index f36bac1..3759345 100644
--- a/includes/installer/DatabaseInstaller.php
+++ b/includes/installer/DatabaseInstaller.php
@@ -369,12 +369,17 @@
        }
 
        /**
-        * 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 46bb86c..5a8403f 100644
--- a/includes/installer/MssqlInstaller.php
+++ b/includes/installer/MssqlInstaller.php
@@ -652,9 +652,9 @@
        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 b82e611..63e8611 100644
--- a/includes/installer/MysqlInstaller.php
+++ b/includes/installer/MysqlInstaller.php
@@ -72,13 +72,6 @@
        }
 
        /**
-        * @return array
-        */
-       public function getGlobalDefaults() {
-               return array();
-       }
-
-       /**
         * @return string
         */
        public function getConnectForm() {
diff --git a/includes/installer/PostgresInstaller.php 
b/includes/installer/PostgresInstaller.php
index c30a989..e19f9aa 100644
--- a/includes/installer/PostgresInstaller.php
+++ b/includes/installer/PostgresInstaller.php
@@ -627,9 +627,9 @@
        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 351b022..cfd8915 100644
--- a/includes/installer/SqliteInstaller.php
+++ b/includes/installer/SqliteInstaller.php
@@ -68,6 +68,7 @@
        }
 
        public function getGlobalDefaults() {
+               $defaults = parent::getGlobalDefaults();
                if ( isset( $_SERVER['DOCUMENT_ROOT'] ) ) {
                        $path = str_replace(
                                array( '/', '\\' ),
@@ -75,10 +76,9 @@
                                dirname( $_SERVER['DOCUMENT_ROOT'] ) . '/data'
                        );
 
-                       return array( 'wgSQLiteDataDir' => $path );
-               } else {
-                       return array();
+                       $defaults['wgSQLiteDataDir'] = $path;
                }
+               return $defaults;
        }
 
        public function getConnectForm() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8217b25e903e40ec82be3d700381ff7aea3b481f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>

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

Reply via email to