DatabaseInstaller::getGlobalDefaults: Return all needed globals
authorumherirrender <umherirrender_de.wp@web.de>
Sun, 11 Jan 2015 18:30:43 +0000 (19:30 +0100)
committerLegoktm <legoktm.wikipedia@gmail.com>
Sun, 22 Feb 2015 00:17:14 +0000 (00:17 +0000)
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
includes/installer/MssqlInstaller.php
includes/installer/MysqlInstaller.php
includes/installer/PostgresInstaller.php
includes/installer/SqliteInstaller.php

index 1c15ad0..6ccf2d5 100644 (file)
@@ -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;
        }
 
        /**
index 46bb86c..5a8403f 100644 (file)
@@ -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',
-               );
+               ) );
        }
 
        /**
index b82e611..63e8611 100644 (file)
@@ -71,13 +71,6 @@ class MysqlInstaller extends DatabaseInstaller {
                return self::checkExtension( 'mysql' ) || self::checkExtension( 'mysqli' );
        }
 
-       /**
-        * @return array
-        */
-       public function getGlobalDefaults() {
-               return array();
-       }
-
        /**
         * @return string
         */
index c30a989..e19f9aa 100644 (file)
@@ -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() {
index 351b022..cfd8915 100644 (file)
@@ -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() {