[TASK] Database install tool driver selection 77/51977/37
authorMona Muzaffar <mona.muzaffar@gmx.de>
Tue, 7 Mar 2017 15:01:53 +0000 (16:01 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 29 Mar 2017 08:59:29 +0000 (10:59 +0200)
Re-implement postgres connect.

Change-Id: Iba0c1c1316c0b473173b08889f213831edbfab65
Resolves: #80173
Releases: master
Reviewed-on: https://review.typo3.org/51977
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Configuration/FactoryConfiguration.php
typo3/sysext/install/Classes/Controller/Action/Step/AbstractStepAction.php
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseConnect.php
typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
typo3/sysext/install/Resources/Private/Partials/Action/Step/DatabaseConnect/ConnectDetails.html
typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseConnect.html
typo3/sysext/install/Resources/Public/JavaScript/Install.js

index df856ef..9a47ae0 100644 (file)
@@ -10,6 +10,14 @@ return [
         'explicitADmode' => 'explicitAllow',
         'loginSecurityLevel' => 'rsa',
     ],
+    'DB' => [
+        'Connections' => [
+            'Default' => [
+                'charset' => 'utf8',
+                'driver' => 'mysqli',
+            ],
+        ],
+    ],
     'EXT' => [
         'extConf' => [
             'rsaauth' => 'a:1:{s:18:"temporaryDirectory";s:0:"";}',
index 9f19d3d..e0e0992 100644 (file)
@@ -14,10 +14,12 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Install\Controller\Action\AbstractAction;
+
 /**
  * General purpose Step controller action
  */
-abstract class AbstractStepAction extends \TYPO3\CMS\Install\Controller\Action\AbstractAction implements StepInterface
+abstract class AbstractStepAction extends AbstractAction implements StepInterface
 {
     /**
      * @var int Current step position
index 8e964e2..946f0d5 100644 (file)
@@ -15,8 +15,12 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  */
 
 use Doctrine\DBAL\DBALException;
+use Doctrine\DBAL\DriverManager;
+use TYPO3\CMS\Core\Configuration\ConfigurationManager;
+use TYPO3\CMS\Core\Database\Connection;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Install\Status\ErrorStatus;
 
 /**
  * Database connect step:
@@ -35,108 +39,117 @@ class DatabaseConnect extends AbstractStepAction
     public function execute()
     {
         $result = [];
-
-        /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
-        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
-
         $postValues = $this->postValues['values'];
+        $defaultConnectionSettings = [];
 
-        $localConfigurationPathValuePairs = [];
-
-        if (isset($postValues['username'])) {
-            $value = $postValues['username'];
-            if (strlen($value) <= 50) {
-                $localConfigurationPathValuePairs['DB/Connections/Default/user'] = $value;
-            } else {
-                /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
-                $errorStatus->setTitle('Database username not valid');
-                $errorStatus->setMessage('Given username must be shorter than fifty characters.');
-                $result[] = $errorStatus;
+        if ($postValues['availableSet'] === 'configurationFromDotEnv') {
+            $defaultConnectionSettings = $this->getConfigurationFromDotEnv();
+        } else {
+            if (isset($postValues['driver'])) {
+                $validDrivers = [
+                    'mysqli',
+                    'pdo_mysql',
+                    'pdo_pgsql',
+                    'mssql',
+                ];
+                if (in_array($postValues['driver'], $validDrivers, true)) {
+                    $defaultConnectionSettings['driver'] = $postValues['driver'];
+                } else {
+                    $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
+                    $errorStatus->setTitle('Database driver unknown');
+                    $errorStatus->setMessage('Given driver must be one of ' . implode(', ', $validDrivers));
+                    $result[] = $errorStatus;
+                }
             }
-        }
-
-        if (isset($postValues['password'])) {
-            $value = $postValues['password'];
-            if (strlen($value) <= 50) {
-                $localConfigurationPathValuePairs['DB/Connections/Default/password'] = $value;
-            } else {
-                /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
-                $errorStatus->setTitle('Database password not valid');
-                $errorStatus->setMessage('Given password must be shorter than fifty characters.');
-                $result[] = $errorStatus;
+            if (isset($postValues['username'])) {
+                $value = $postValues['username'];
+                if (strlen($value) <= 50) {
+                    $defaultConnectionSettings['user'] = $value;
+                } else {
+                    $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
+                    $errorStatus->setTitle('Database username not valid');
+                    $errorStatus->setMessage('Given username must be shorter than fifty characters.');
+                    $result[] = $errorStatus;
+                }
             }
-        }
-
-        if (isset($postValues['host'])) {
-            $value = $postValues['host'];
-            if (preg_match('/^[a-zA-Z0-9_\\.-]+(:.+)?$/', $value) && strlen($value) <= 255) {
-                $localConfigurationPathValuePairs['DB/Connections/Default/host'] = $value;
-            } else {
-                /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
-                $errorStatus->setTitle('Database host not valid');
-                $errorStatus->setMessage('Given host is not alphanumeric (a-z, A-Z, 0-9 or _-.:) or longer than 255 characters.');
-                $result[] = $errorStatus;
+            if (isset($postValues['password'])) {
+                $value = $postValues['password'];
+                if (strlen($value) <= 50) {
+                    $defaultConnectionSettings['password'] = $value;
+                } else {
+                    $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
+                    $errorStatus->setTitle('Database password not valid');
+                    $errorStatus->setMessage('Given password must be shorter than fifty characters.');
+                    $result[] = $errorStatus;
+                }
             }
-        }
-
-        if (isset($postValues['port']) && $postValues['host'] !== 'localhost') {
-            $value = $postValues['port'];
-            if (preg_match('/^[0-9]+(:.+)?$/', $value) && $value > 0 && $value <= 65535) {
-                $localConfigurationPathValuePairs['DB/Connections/Default/port'] = (int)$value;
-            } else {
-                /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
-                $errorStatus->setTitle('Database port not valid');
-                $errorStatus->setMessage('Given port is not numeric or within range 1 to 65535.');
-                $result[] = $errorStatus;
+            if (isset($postValues['host'])) {
+                $value = $postValues['host'];
+                if (preg_match('/^[a-zA-Z0-9_\\.-]+(:.+)?$/', $value) && strlen($value) <= 255) {
+                    $defaultConnectionSettings['host'] = $value;
+                } else {
+                    $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
+                    $errorStatus->setTitle('Database host not valid');
+                    $errorStatus->setMessage('Given host is not alphanumeric (a-z, A-Z, 0-9 or _-.:) or longer than 255 characters.');
+                    $result[] = $errorStatus;
+                }
             }
-        }
-
-        if (isset($postValues['socket']) && $postValues['socket'] !== '') {
-            if (@file_exists($postValues['socket'])) {
-                $localConfigurationPathValuePairs['DB/Connections/Default/unix_socket'] = $postValues['socket'];
-            } else {
-                /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
-                $errorStatus->setTitle('Socket does not exist');
-                $errorStatus->setMessage('Given socket location does not exist on server.');
-                $result[] = $errorStatus;
+            if (isset($postValues['port']) && $postValues['host'] !== 'localhost') {
+                $value = $postValues['port'];
+                if (preg_match('/^[0-9]+(:.+)?$/', $value) && $value > 0 && $value <= 65535) {
+                    $defaultConnectionSettings['port'] = (int)$value;
+                } else {
+                    $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
+                    $errorStatus->setTitle('Database port not valid');
+                    $errorStatus->setMessage('Given port is not numeric or within range 1 to 65535.');
+                    $result[] = $errorStatus;
+                }
             }
-        }
-
-        if (isset($postValues['database'])) {
-            $value = $postValues['database'];
-            if (strlen($value) <= 50) {
-                $localConfigurationPathValuePairs['DB/Connections/Default/dbname'] = $value;
-            } else {
-                /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
-                $errorStatus->setTitle('Database name not valid');
-                $errorStatus->setMessage('Given database name must be shorter than fifty characters.');
-                $result[] = $errorStatus;
+            if (isset($postValues['socket']) && $postValues['socket'] !== '') {
+                if (@file_exists($postValues['socket'])) {
+                    $defaultConnectionSettings['unix_socket'] = $postValues['socket'];
+                } else {
+                    $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
+                    $errorStatus->setTitle('Socket does not exist');
+                    $errorStatus->setMessage('Given socket location does not exist on server.');
+                    $result[] = $errorStatus;
+                }
+            }
+            if (isset($postValues['database'])) {
+                $value = $postValues['database'];
+                if (strlen($value) <= 50) {
+                    $defaultConnectionSettings['dbname'] = $value;
+                } else {
+                    $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
+                    $errorStatus->setTitle('Database name not valid');
+                    $errorStatus->setMessage('Given database name must be shorter than fifty characters.');
+                    $result[] = $errorStatus;
+                }
             }
         }
 
-        if (!empty($localConfigurationPathValuePairs)) {
-            $configurationManager->setLocalConfigurationValuesByPathValuePairs($localConfigurationPathValuePairs);
-
-            // After setting new credentials, test again and create an error message if connect is not successful
-            // @TODO: This could be simplified, if isConnectSuccessful could be released from TYPO3_CONF_VARS
-            // and fed with connect values directly in order to obsolete the bootstrap reload.
-            \TYPO3\CMS\Core\Core\Bootstrap::getInstance()
-                ->populateLocalConfiguration()
-                ->disableCoreCache();
-            $exceptionMessage = $this->isConnectSuccessfulWithExceptionMessage();
-            if (!empty($exceptionMessage)) {
-                /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+        if (!empty($defaultConnectionSettings)) {
+            // Test connection settings and write to config if connect is successful
+            try {
+                $connectionParams = $defaultConnectionSettings;
+                $connectionParams['wrapperClass'] = Connection::class;
+                $connectionParams['charset'] = 'utf-8';
+                DriverManager::getConnection($connectionParams)->ping();
+            } catch (DBALException $e) {
+                $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
                 $errorStatus->setTitle('Database connect not successful');
-                $errorStatus->setMessage('Connecting to the database with given settings failed: ' . $exceptionMessage);
+                $errorStatus->setMessage('Connecting to the database with given settings failed: ' . $e->getMessage());
                 $result[] = $errorStatus;
             }
+            $localConfigurationPathValuePairs = [];
+            foreach ($defaultConnectionSettings as $settingsName => $value) {
+                $localConfigurationPathValuePairs['DB/Connections/Default/' . $settingsName] = $value;
+            }
+            $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
+            // Remove full default connection array
+            $configurationManager->removeLocalConfigurationKeysByPath([ 'DB/Connections/Default' ]);
+            // Write new values
+            $configurationManager->setLocalConfigurationValuesByPathValuePairs($localConfigurationPathValuePairs);
         }
 
         return $result;
@@ -153,13 +166,6 @@ class DatabaseConnect extends AbstractStepAction
         if ($this->isConnectSuccessful() && $this->isConfigurationComplete()) {
             return false;
         }
-        if (!$this->isHostConfigured()) {
-            $this->useDefaultValuesForNotConfiguredOptions();
-            throw new \TYPO3\CMS\Install\Controller\Exception\RedirectException(
-                'Wrote default settings to LocalConfiguration.php, redirect needed',
-                1377611168
-            );
-        }
         return true;
     }
 
@@ -170,18 +176,64 @@ class DatabaseConnect extends AbstractStepAction
      */
     protected function executeAction()
     {
-        $this->view
-            ->assign('username', $this->getConfiguredUsername())
-            ->assign('password', $this->getConfiguredPassword())
-            ->assign('host', $this->getConfiguredHost())
-            ->assign('port', $this->getConfiguredOrDefaultPort())
-            ->assign('database', $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname'] ?: '')
-            ->assign('socket', $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['unix_socket'] ?: '')
-            ->assign('renderConnectDetailsUsername', true)
-            ->assign('renderConnectDetailsPassword', true)
-            ->assign('renderConnectDetailsHost', true)
-            ->assign('renderConnectDetailsPort', true)
-            ->assign('renderConnectDetailsSocket', true);
+        $hasAtLeastOneOption = false;
+        $activeAvailableOption = '';
+        if (extension_loaded('mysqli')) {
+            $hasAtLeastOneOption = true;
+            $this->view->assign('hasMysqliManualConfiguration', true);
+            $mysqliManualConfigurationOptions = [
+                'username' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user'] ?? '',
+                'password' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password'] ?? '',
+                'port' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['port'] ?? 3306,
+            ];
+            $host = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'] ?? '127.0.0.1';
+            if ($host === 'localhost') {
+                $host = '127.0.0.1';
+            }
+            $mysqliManualConfigurationOptions['host'] = $host;
+            $this->view->assign('mysqliManualConfigurationOptions', $mysqliManualConfigurationOptions);
+            $activeAvailableOption = 'mysqliManualConfiguration';
+
+            $this->view->assign('hasMysqliSocketManualConfiguration', true);
+            $this->view->assign(
+                'mysqliSocketManualConfigurationOptions',
+                [
+                    'username' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user'] ?? '',
+                    'password' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password'] ?? '',
+                    'socket' => $this->getConfiguredMysqliSocket(),
+                ]
+            );
+            if ($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['driver'] === 'mysqli'
+                && $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'] === 'localhost') {
+                $activeAvailableOption = 'mysqliSocketManualConfiguration';
+            }
+        }
+        if (extension_loaded('pdo_pgsql')) {
+            $hasAtLeastOneOption = true;
+            $this->view->assign('hasPostgresManualConfiguration', true);
+            $this->view->assign(
+                'postgresManualConfigurationOptions',
+                [
+                    'username' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user'] ?? '',
+                    'password' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password'] ?? '',
+                    'host' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'] ?? '127.0.0.1',
+                    'port' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['port'] ?? 5432,
+                    'database' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname'] ?? '',
+                ]
+            );
+            if ($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['driver'] === 'pdo_pgsql') {
+                $activeAvailableOption = 'postgresManualConfiguration';
+            }
+        }
+
+        if (!empty($this->getConfigurationFromDotEnv())) {
+            $hasAtLeastOneOption = true;
+            $activeAvailableOption = 'configurationFromDotEnv';
+            $this->view->assign('hasConfigurationFromDotEnv', true);
+        }
+
+        $this->view->assign('hasAtLeastOneOption', $hasAtLeastOneOption);
+        $this->view->assign('activeAvailableOption', $activeAvailableOption);
 
         $this->assignSteps();
 
@@ -189,22 +241,6 @@ class DatabaseConnect extends AbstractStepAction
     }
 
     /**
-     * Render connect port and label
-     *
-     * @return int Configured or default port
-     */
-    protected function getConfiguredOrDefaultPort()
-    {
-        $configuredPort = (int)$this->getConfiguredPort();
-        if (!$configuredPort) {
-            $port = 3306;
-        } else {
-            $port = $configuredPort;
-        }
-        return $port;
-    }
-
-    /**
      * Test connection with given credentials
      *
      * @return bool true if connect was successful
@@ -231,36 +267,13 @@ class DatabaseConnect extends AbstractStepAction
 
     /**
      * Check LocalConfiguration.php for required database settings:
-     * - 'host' is mandatory and must not be empty
-     * - 'port' OR 'socket' is mandatory, but may be empty
-     *
-     * @return bool TRUE if host is set
-     */
-    protected function isHostConfigured()
-    {
-        $hostConfigured = true;
-        if (empty($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'])) {
-            $hostConfigured = false;
-        }
-        if (!isset($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['port'])
-            && !isset($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['unix_socket'])
-        ) {
-            $hostConfigured = false;
-        }
-        return $hostConfigured;
-    }
-
-    /**
-     * Check LocalConfiguration.php for required database settings:
-     * - 'host' is mandatory and must not be empty
-     * - 'port' OR 'socket' is mandatory, but may be empty
      * - 'username' and 'password' are mandatory, but may be empty
      *
      * @return bool TRUE if required settings are present
      */
     protected function isConfigurationComplete()
     {
-        $configurationComplete = $this->isHostConfigured();
+        $configurationComplete = true;
         if (!isset($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user'])) {
             $configurationComplete = false;
         }
@@ -271,68 +284,13 @@ class DatabaseConnect extends AbstractStepAction
     }
 
     /**
-     * Write DB settings to LocalConfiguration.php, using default values.
-     * With the switch from mysql to mysqli in 6.1, some mandatory settings were
-     * added. This method tries to add those settings in case of an upgrade, and
-     * pre-configures settings in case of a "new" install process.
+     * Returns configured socket, if set.
      *
-     * There are two different connection types:
-     * - Unix domain socket. This may be available if mysql is running on localhost
-     * - TCP/IP connection to some mysql system somewhere.
-     *
-     * Unix domain socket connections are quicker than TCP/IP, so it is
-     * tested if a unix domain socket connection to localhost is successful. If not,
-     * a default configuration for TCP/IP is used.
-     */
-    protected function useDefaultValuesForNotConfiguredOptions()
-    {
-        $localConfigurationPathValuePairs = [];
-
-        $localConfigurationPathValuePairs['DB/Connections/Default/host'] = $this->getConfiguredHost();
-
-        // If host is "local" either by upgrading or by first install, we try a socket
-        // connection first and use TCP/IP as fallback
-        if ($localConfigurationPathValuePairs['DB/Connections/Default/host'] === 'localhost'
-            || GeneralUtility::cmpIP($localConfigurationPathValuePairs['DB/Connections/Default/host'], '127.*.*.*')
-            || (string)$localConfigurationPathValuePairs['DB/Connections/Default/host'] === ''
-        ) {
-            if ($this->isConnectionWithUnixDomainSocketPossible()) {
-                $localConfigurationPathValuePairs['DB/Connections/Default/host'] = 'localhost';
-                $localConfigurationPathValuePairs['DB/Connections/Default/unix_socket'] = $this->getConfiguredSocket();
-            } else {
-                if (!GeneralUtility::isFirstPartOfStr($localConfigurationPathValuePairs['DB/Connections/Default/host'], '127.')) {
-                    $localConfigurationPathValuePairs['DB/Connections/Default/host'] = '127.0.0.1';
-                }
-            }
-        }
-
-        if (!isset($localConfigurationPathValuePairs['DB/Connections/Default/unix_socket'])) {
-            // Make sure a default port is set if not configured yet
-            // This is independent from any host configuration
-            $port = $this->getConfiguredPort();
-            if ($port > 0) {
-                $localConfigurationPathValuePairs['DB/Connections/Default/port'] = $port;
-            } else {
-                $localConfigurationPathValuePairs['DB/Connections/Default/port'] = $this->getConfiguredOrDefaultPort();
-            }
-        }
-
-        /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
-        $configurationManager->setLocalConfigurationValuesByPathValuePairs($localConfigurationPathValuePairs);
-    }
-
-    /**
-     * Test if a unix domain socket can be opened. This does not
-     * authenticate but only tests if a connect is successful.
-     *
-     * @return bool TRUE on success
+     * @return string
      */
-    protected function isConnectionWithUnixDomainSocketPossible()
+    protected function getConfiguredMysqliSocket()
     {
-        $result = false;
-        // Use configured socket
-        $socket = (string)$this->getConfiguredSocket();
+        $socket = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['unix_socket'] ?? '';
         if ($socket === '') {
             // If no configured socket, use default php socket
             $defaultSocket = (string)ini_get('mysqli.default_socket');
@@ -340,77 +298,64 @@ class DatabaseConnect extends AbstractStepAction
                 $socket = $defaultSocket;
             }
         }
-        if ($socket !== '') {
-            $socketOpenResult = @fsockopen('unix://' . $socket);
-            if ($socketOpenResult) {
-                fclose($socketOpenResult);
-                $result = true;
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * Returns configured username, if set
-     *
-     * @return string
-     */
-    protected function getConfiguredUsername()
-    {
-        $username = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user'] ?? '';
-        return $username;
-    }
-
-    /**
-     * Returns configured password, if set
-     *
-     * @return string
-     */
-    protected function getConfiguredPassword()
-    {
-        $password = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password'] ?? '';
-        return $password;
+        return $socket;
     }
 
     /**
-     * Returns configured host with port split off if given
+     * Try to fetch db credentials from a .env file and see if connect works
      *
-     * @return string
+     * @return array Empty array if no file is found or connect is not successful, else working credentials
      */
-    protected function getConfiguredHost()
+    protected function getConfigurationFromDotEnv(): array
     {
-        $host = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'] ?? '';
-        $port = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['port'] ?? '';
-        if (strlen($port) < 1 && substr_count($host, ':') === 1) {
-            list($host) = explode(':', $host);
+        $envCredentials = [];
+        if (file_exists(PATH_site . '/../.env')) {
+            $env = file_get_contents(PATH_site . '/../.env');
+            $envArray = explode("\n", $env);
+            foreach ($envArray as $val) {
+                if (strpos($val, 'TYPO3_DB_DRIVER') !== false) {
+                    $driver = substr($val, strpos($val, '=') + 1);
+                    $driver = trim($driver, " \t\n\r\0\x0B\"");
+                    $envCredentials['driver'] = $driver;
+                } elseif (strpos($val, 'TYPO3_DB_NAME') !== false) {
+                    $database = substr($val, strpos($val, '=') + 1);
+                    $database = trim($database, " \t\n\r\0\x0B\"");
+                    $envCredentials['database'] = $database;
+                } elseif (strpos($val, 'TYPO3_DB_HOST') !== false) {
+                    $host = substr($val, strpos($val, '=') + 1);
+                    $host = trim($host, " \t\n\r\0\x0B\"");
+                    $envCredentials['host'] = $host;
+                } elseif (strpos($val, 'TYPO3_DB_USER') !== false) {
+                    $user = substr($val, strpos($val, '=') + 1);
+                    $user = trim($user, " \t\n\r\0\x0B\"");
+                    $envCredentials['user'] = $user;
+                } elseif (strpos($val, 'TYPO3_DB_PASSWORD') !== false) {
+                    $password = substr($val, strpos($val, '=') + 1);
+                    $password = trim($password, " \t\n\r\0\x0B\"");
+                    $envCredentials['password'] = $password;
+                } elseif (strpos($val, 'TYPO3_DB_PORT') !== false) {
+                    $port = substr($val, strpos($val, '=') + 1);
+                    $port = trim($port, " \t\n\r\0\x0B\"");
+                    $envCredentials['port'] = $port;
+                } elseif (strpos($val, 'TYPO3_DB_SOCKET') !== false) {
+                    $port = substr($val, strpos($val, '=') + 1);
+                    $port = trim($port, " \t\n\r\0\x0B\"");
+                    $envCredentials['unix_socket'] = $port;
+                }
+            }
         }
-        return $host;
-    }
 
-    /**
-     * Returns configured port. Gets port from host value if port is not yet set.
-     *
-     * @return int
-     */
-    protected function getConfiguredPort()
-    {
-        $host = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'] ?? '';
-        $port = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['port'] ?? '';
-        if ($port === '' && substr_count($host, ':') === 1) {
-            $hostPortArray = explode(':', $host);
-            $port = $hostPortArray[1];
+        if (!empty($envCredentials)) {
+            $connectionParams = $envCredentials;
+            $connectionParams['wrapperClass'] = Connection::class;
+            $connectionParams['charset'] = 'utf-8';
+            try {
+                DriverManager::getConnection($connectionParams)->ping();
+                return $envCredentials;
+            } catch (DBALException $e) {
+                return [];
+            }
         }
-        return (int)$port;
-    }
-
-    /**
-     * Returns configured socket, if set
-     *
-     * @return string|NULL
-     */
-    protected function getConfiguredSocket()
-    {
-        $socket = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['unix_socket'] ?? '';
-        return $socket;
+        return [];
     }
 }
index 3512cdf..3ffe2f0 100644 (file)
@@ -603,77 +603,116 @@ class SilentConfigurationUpgradeService
      */
     protected function migrateDatabaseConnectionSettings()
     {
-        $changedSettings = [];
-        $settingsToRename = [
-            'DB/username' => 'DB/Connections/Default/user',
-            'DB/password' => 'DB/Connections/Default/password',
-            'DB/host' => 'DB/Connections/Default/host',
-            'DB/port' => 'DB/Connections/Default/port',
-            'DB/socket' => 'DB/Connections/Default/unix_socket',
-            'DB/database' => 'DB/Connections/Default/dbname',
-            'SYS/setDBinit' => 'DB/Connections/Default/initCommands',
-            'SYS/no_pconnect' => 'DB/Connections/Default/persistentConnection',
-            'SYS/dbClientCompress' => 'DB/Connections/Default/driverOptions',
+        $confManager = $this->configurationManager;
 
-        ];
+        $newSettings = [];
+        $removeSettings = [];
 
-        $confManager = $this->configurationManager;
+        try {
+            $value = $confManager->getLocalConfigurationValueByPath('DB/username');
+            $removeSettings[] = 'DB/username';
+            $newSettings['DB/Connections/Default/user'] = $value;
+        } catch (\RuntimeException $e) {
+            // Old setting does not exist, do nothing
+        }
 
-        foreach ($settingsToRename as $oldPath => $newPath) {
-            try {
-                $value = $confManager->getLocalConfigurationValueByPath($oldPath);
-                $confManager->setLocalConfigurationValueByPath($newPath, $value);
-                $changedSettings[$oldPath] = true;
-            } catch (\RuntimeException $e) {
-                // If an exception is thrown, the value is not set in LocalConfiguration
-                $changedSettings[$oldPath] = false;
+        try {
+            $value= $confManager->getLocalConfigurationValueByPath('DB/password');
+            $removeSettings[] = 'DB/password';
+            $newSettings['DB/Connections/Default/password'] = $value;
+        } catch (\RuntimeException $e) {
+            // Old setting does not exist, do nothing
+        }
+
+        try {
+            $value = $confManager->getLocalConfigurationValueByPath('DB/host');
+            $removeSettings[] = 'DB/host';
+            $newSettings['DB/Connections/Default/host'] = $value;
+        } catch (\RuntimeException $e) {
+            // Old setting does not exist, do nothing
+        }
+
+        try {
+            $value = $confManager->getLocalConfigurationValueByPath('DB/port');
+            $removeSettings[] = 'DB/port';
+            $newSettings['DB/Connections/Default/port'] = $value;
+        } catch (\RuntimeException $e) {
+            // Old setting does not exist, do nothing
+        }
+
+        try {
+            $value = $confManager->getLocalConfigurationValueByPath('DB/socket');
+            $removeSettings[] = 'DB/socket';
+            // Remove empty socket connects
+            if (!empty($value)) {
+                $newSettings['DB/Connections/Default/unix_socket'] = $value;
             }
+        } catch (\RuntimeException $e) {
+            // Old setting does not exist, do nothing
         }
 
-        // Remove empty socket connects
-        if (!empty($changedSettings['DB/Connections/Default/unix_socket'])) {
-            $value = $confManager->getLocalConfigurationValueByPath('DB/Connections/Default/unix_socket');
-            if (empty($value)) {
-                $confManager->removeLocalConfigurationKeysByPath(array_keys('DB/Connections/Default/unix_socket'));
+        try {
+            $value = $confManager->getLocalConfigurationValueByPath('DB/database');
+            $removeSettings[] = 'DB/database';
+            $newSettings['DB/Connections/Default/dbname'] = $value;
+        } catch (\RuntimeException $e) {
+            // Old setting does not exist, do nothing
+        }
+
+        try {
+            $value = (bool)$confManager->getLocalConfigurationValueByPath('SYS/dbClientCompress');
+            $removeSettings[] = 'SYS/dbClientCompress';
+            if ($value) {
+                $newSettings['DB/Connections/Default/driverOptions'] = [
+                    'flags' => MYSQLI_CLIENT_COMPRESS,
+                ];
             }
+        } catch (\RuntimeException $e) {
+            // Old setting does not exist, do nothing
         }
 
-        // Convert the dbClientCompress flag to a mysqli driver option
-        if (!empty($changedSettings['DB/Connections/Default/driverOptions'])) {
-            $value = $confManager->getLocalConfigurationValueByPath('DB/Connections/Default/driverOptions');
-            $confManager->setLocalConfigurationValueByPath(
-                'DB/Connections/Default/driverOptions',
-                [
-                    'flags' => (bool)$value ? MYSQLI_CLIENT_COMPRESS : 0,
-                ]
-            );
+        try {
+            $value = (bool)$confManager->getLocalConfigurationValueByPath('SYS/no_pconnect');
+            $removeSettings[] = 'SYS/no_pconnect';
+            if (!$value) {
+                $newSettings['DB/Connections/Default/persistentConnection'] = true;
+            }
+        } catch (\RuntimeException $e) {
+            // Old setting does not exist, do nothing
         }
 
-        // Swap value as the semantics have changed
-        if (!empty($changedSettings['DB/Connections/Default/persistentConnection'])) {
-            $value = $confManager->getLocalConfigurationValueByPath('DB/Connections/Default/persistentConnection');
-            $confManager->setLocalConfigurationValueByPath(
-                'DB/Connections/Default/persistentConnection',
-                !$value
-            );
+        try {
+            $value = $confManager->getLocalConfigurationValueByPath('SYS/setDBinit');
+            $removeSettings[] = 'SYS/setDBinit';
+            $newSettings['DB/Connections/Default/initCommands'] = $value;
+        } catch (\RuntimeException $e) {
+            // Old setting does not exist, do nothing
         }
 
-        // Set the utf-8 connection charset by default if no value has been provided yet
         try {
             $confManager->getLocalConfigurationValueByPath('DB/Connections/Default/charset');
         } catch (\RuntimeException $e) {
-            $confManager->setLocalConfigurationValueByPath('DB/Connections/Default/charset', 'utf8');
+            // If there is no charset option yet, add it.
+            $newSettings['DB/Connections/Default/charset'] = 'utf8';
         }
 
-        // Use the mysqli driver by default if no value has been provided yet
         try {
             $confManager->getLocalConfigurationValueByPath('DB/Connections/Default/driver');
         } catch (\RuntimeException $e) {
-            $confManager->setLocalConfigurationValueByPath('DB/Connections/Default/driver', 'mysqli');
+            // Use the mysqli driver by default if no value has been provided yet
+            $newSettings['DB/Connections/Default/driver'] = 'mysqli';
         }
 
-        if (!empty(array_filter($changedSettings))) {
-            $confManager->removeLocalConfigurationKeysByPath(array_keys($changedSettings));
+        // Add new settings and remove old ones
+        if (!empty($newSettings)) {
+            $confManager->setLocalConfigurationValuesByPathValuePairs($newSettings);
+        }
+        if (!empty($removeSettings)) {
+            $confManager->removeLocalConfigurationKeysByPath($removeSettings);
+        }
+
+        // Throw redirect if something was changed
+        if (!empty($newSettings) || !empty($removeSettings)) {
             $this->throwRedirectException();
         }
     }
index 0321f48..893baa7 100644 (file)
-<p>&nbsp;</p>
 <div class="row">
        <div class="col-md-6">
                <form method="post" class="form-horizontal">
-                       <f:render partial="Action/Common/HiddenFormFields" arguments="{_all}" />
-                       <input type="hidden" value="execute" name="install[set]" />
+                       <f:render partial="Action/Common/HiddenFormFields" arguments="{_all}"/>
+                       <input type="hidden" value="execute" name="install[set]"/>
 
-                       <f:if condition="{renderConnectDetailsUsername}">
-                               <div class="form-group">
-                                       <label for="t3-install-step-username" class="control-label col-md-2">Username</label>
-                                       <div class="col-md-10">
-                                               <input id="t3-install-step-username" class="form-control" type="text" value="{username}" name="install[values][username]" autocomplete="off" />
-                                       </div>
+                       <div class="form-group">
+                               <label for="t3js-connect-database-driver" class="control-label col-md-2">Available</label>
+                               <div class="col-md-10">
+                                       <select id="t3js-connect-database-driver" class="form-control" name="install[values][availableSet]">
+                                               <f:if condition="{hasMysqliManualConfiguration}">
+                                                       <option value="mysqliManualConfiguration" {f:if(condition:
+                                                       '{activeAvailableOption} == mysqliManualConfiguration', then: 'selected="selected"')}>Manually configured
+                                                       MySQL TCP/IP connection</option>
+                                               </f:if>
+                                               <f:if condition="{hasMysqliSocketManualConfiguration}">
+                                                       <option value="mysqliSocketManualConfiguration" {f:if(condition:
+                                                       '{activeAvailableOption} == mysqliSocketManualConfiguration', then: 'selected="selected"')}>Manually
+                                                       configured MySQL socket connection</option>
+                                               </f:if>
+                                               <f:if condition="{hasPostgresManualConfiguration}">
+                                                       <option value="postgresManualConfiguration" {f:if(condition:
+                                                       '{activeAvailableOption} == postgresManualConfiguration', then: 'selected="selected"')}>Manually
+                                                       configured PostgreSQL connection</option>
+                                               </f:if>
+                                               <f:if condition="{hasConfigurationFromDotEnv}">
+                                                       <option value="configurationFromDotEnv" {f:if(condition:
+                                                       '{activeAvailableOption} == configurationFromDotEnv', then: 'selected="selected"')}>Configuration from
+                                                       .env file</option>
+                                               </f:if>
+                                       </select>
                                </div>
-                       </f:if>
-                       <f:if condition="{renderConnectDetailsPassword}">
-                               <div class="form-group">
-                                       <label for="t3-install-step-password" class="control-label col-md-2">Password</label>
-                                       <div class="col-md-10">
-                                               <input id="t3-install-step-password" class="form-control" type="password" value="{password}" name="install[values][password]" autocomplete="off" />
+                       </div>
+
+                       <f:if condition="{hasMysqliManualConfiguration}">
+                               <div id="mysqliManualConfiguration" class="t3-install-driver-data">
+                                       <input type="hidden" value="mysqli" name="install[values][driver]"/>
+                                       <div class="form-group">
+                                               <label for="t3-install-step-mysqliManualConfiguration-username"
+                                                                        class="control-label col-md-2">Username</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-mysqliManualConfiguration-username" class="form-control" type="text"
+                                                                                value="{mysqliManualConfigurationOptions.username}" name="install[values][username]"
+                                                                                autocomplete="off"/>
+                                               </div>
+                                       </div>
+                                       <div class="form-group">
+                                               <label for="t3-install-step-mysqliManualConfiguration-password"
+                                                                        class="control-label col-md-2">Password</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-mysqliManualConfiguration-password" class="form-control" type="password"
+                                                                                value="{mysqliManualConfigurationOptions.password}" name="install[values][password]"
+                                                                                autocomplete="off"/>
+                                               </div>
+                                       </div>
+                                       <div class="form-group">
+                                               <label for="t3-install-step-mysqliManualConfiguration-host" class="control-label col-md-2">Host</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-mysqliManualConfiguration-host" class="t3-install-form-input-text form-control"
+                                                                                type="text" value="{mysqliManualConfigurationOptions.host}" name="install[values][host]"/>
+                                               </div>
+                                       </div>
+                                       <div class="form-group">
+                                               <label for="t3-install-step-mysqliManualConfiguration-port" class="control-label col-md-2">Port</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-mysqliManualConfiguration-port" class="t3-install-form-input-text form-control"
+                                                                                type="text" value="{mysqliManualConfigurationOptions.port}" name="install[values][port]"/>
+                                               </div>
                                        </div>
                                </div>
                        </f:if>
-                       <f:if condition="{renderConnectDetailsHost}">
-                               <div class="form-group">
-                                       <label for="t3-install-step-type" class="control-label col-md-2">Type</label>
-                                       <div class="col-md-10">
-                                               <select id="t3-install-step-type" class="form-control">
-                                                       <option value="tcp">TCP/IP based connection</option>
-                                                       <option value="socket" {f:if(condition:'{host} == \'localhost\'',then:'selected="selected"')}>Socket based connection</option>
-                                               </select>
+
+                       <f:if condition="{hasMysqliSocketManualConfiguration}">
+                               <div id="mysqliSocketManualConfiguration" class="t3-install-driver-data">
+                                       <input type="hidden" value="mysqli" name="install[values][driver]"/>
+                                       <div class="form-group">
+                                               <label for="t3-install-step-mysqliSocketManualConfiguration-username" class="control-label col-md-2">Username</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-mysqliSocketManualConfiguration-username" class="form-control" type="text"
+                                                                                value="{mysqliSocketManualConfigurationOptions.username}" name="install[values][username]"
+                                                                                autocomplete="off"/>
+                                               </div>
                                        </div>
-                               </div>
-                               <div class="form-group">
-                                       <label for="t3-install-step-host" class="control-label col-md-2">Host</label>
-                                       <div class="col-md-10">
-                                               <input id="t3-install-step-host" class="t3-install-form-input-text form-control" type="text" value="{host}" name="install[values][host]" />
+                                       <div class="form-group">
+                                               <label for="t3-install-step-mysqliSocketManualConfiguration-password" class="control-label col-md-2">Password</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-mysqliSocketManualConfiguration-password" class="form-control" type="password"
+                                                                                value="{mysqliSocketManualConfigurationOptions.password}" name="install[values][password]"
+                                                                                autocomplete="off"/>
+                                               </div>
+                                       </div>
+                                       <input type="hidden" value="localhost" name="install[values][host]"/>
+                                       <div class="form-group">
+                                               <label for="t3-install-step-mysqliSocketManualConfiguration-socket"
+                                                                        class="control-label col-md-2">Socket</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-mysqliSocketManualConfiguration-socket"
+                                                                                class="t3-install-form-input-text form-control" type="text"
+                                                                                value="{mysqliSocketManualConfigurationOptions.socket}" name="install[values][socket]"
+                                                                                placeholder="Default socket or enter name"/>
+                                               </div>
                                        </div>
                                </div>
                        </f:if>
-                       <f:if condition="{renderConnectDetailsPort}">
-                               <div class="form-group">
-                                       <label for="t3-install-step-port" class="control-label col-md-2">Port</label>
-                                       <div class="col-md-10">
-                                               <input id="t3-install-step-port" class="t3-install-form-input-text form-control" type="text" value="{port}" name="install[values][port]" />
+
+                       <f:if condition="{hasPostgresManualConfiguration}">
+                               <div id="postgresManualConfiguration" class="t3-install-driver-data">
+                                       <input type="hidden" value="pdo_pgsql" name="install[values][driver]"/>
+                                       <div class="form-group">
+                                               <label for="t3-install-step-postgresManualConfiguration-username"
+                                                                        class="control-label col-md-2">Username</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-postgresManualConfiguration-username" class="form-control" type="text"
+                                                                                value="{postgresManualConfigurationOptions.username}" name="install[values][username]"
+                                                                                autocomplete="off"/>
+                                               </div>
+                                       </div>
+                                       <div class="form-group">
+                                               <label for="t3-install-step-postgresManualConfiguration-password"
+                                                                        class="control-label col-md-2">Password</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-postgresManualConfiguration-password" class="form-control" type="password"
+                                                                                value="{postgresManualConfigurationOptions.password}" name="install[values][password]"
+                                                                                autocomplete="off"/>
+                                               </div>
+                                       </div>
+                                       <div class="form-group">
+                                               <label for="t3-install-step-postgresManualConfiguration-database"
+                                                                        class="control-label col-md-2">Database</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-postgresManualConfiguration-database"
+                                                                                class="t3-install-form-input-text form-control" type="text"
+                                                                                value="{postgresManualConfigurationOptions.database}" name="install[values][database]"/>
+                                               </div>
+                                       </div>
+                                       <div class="form-group">
+                                               <label for="t3-install-step-postgresManualConfiguration-host" class="control-label col-md-2">Host</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-postgresManualConfiguration-host"
+                                                                                class="t3-install-form-input-text form-control" type="text"
+                                                                                value="{postgresManualConfigurationOptions.host}" name="install[values][host]"/>
+                                               </div>
+                                       </div>
+                                       <div class="form-group">
+                                               <label for="t3-install-step-postgresManualConfiguration-port" class="control-label col-md-2">Port</label>
+                                               <div class="col-md-10">
+                                                       <input id="t3-install-step-postgresManualConfiguration-port"
+                                                                                class="t3-install-form-input-text form-control" type="text"
+                                                                                value="{postgresManualConfigurationOptions.port}" name="install[values][port]"/>
+                                               </div>
                                        </div>
                                </div>
                        </f:if>
-                       <f:if condition="{renderConnectDetailsSocket}">
-                               <div class="form-group">
-                                       <label for="t3-install-step-socket" class="control-label col-md-2">Socket</label>
-                                       <div class="col-md-10">
-                                               <input id="t3-install-step-socket" class="t3-install-form-input-text form-control" type="text" value="{socket}" name="install[values][socket]" placeholder="Default socket or enter name" />
-                                       </div>
+
+                       <f:if condition="{hasConfigurationFromDotEnv}">
+                               <div id="configurationFromDotEnv" class="t3-install-driver-data">
                                </div>
                        </f:if>
 
+                       <hr/>
                        <button class="btn btn-success" type="submit">
                                Continue
                        </button>
                </form>
-               <hr />
        </div>
-</div>
\ No newline at end of file
+</div>
index c5c1afe..7504b5b 100644 (file)
@@ -6,11 +6,20 @@
        <f:render partial="Action/Step/StepCounter.html" arguments="{steps: steps, currentStep: currentStep}" />
 
        <h3>Database connection</h3>
+       <f:if condition="{hasAtLeastOneOption}">
+               <f:then>
+                       <p>
+                               If you have not already created a username and password to access the database, please do so now.
+                               This can be done using tools provided by your host.
+                       </p>
+                       <f:render partial="Action/Step/DatabaseConnect/ConnectDetails" arguments="{_all}" />
+               </f:then>
+               <f:else>
+                       <div class="t3js-message typo3-message alert alert-danger" role="alert">
+                               <h4>No database driver found</h4>
+                               <p class="messageText">You have no database driver installed or enabled. Please install a driver in order to complete the database connection.</p>
+                       </div>
+               </f:else>
+       </f:if>
+</f:section>
 
-       <p>
-               If you have not already created a username and password to access the database, please do so now.
-               This can be done using tools provided by your host.
-       </p>
-
-       <f:render partial="Action/Step/DatabaseConnect/ConnectDetails" arguments="{_all}" />
-</f:section>
\ No newline at end of file
index 955d400..a7b8c22 100644 (file)
@@ -875,25 +875,12 @@ $(function() {
        });
 
        // Install step database settings
-       $('#t3-install-step-type').change(function() {
-               var connectionType = $(this).val(),
-                       hostField = $('#t3-install-step-host'),
-                       portField = $('#t3-install-step-port'),
-                       socketField = $('#t3-install-step-socket');
-
-               if (connectionType === 'socket') {
-                       hostField.parents('.form-group').fadeOut();
-                       hostField.val('localhost');
-                       portField.parents('.form-group').fadeOut();
-                       socketField.parents('.form-group').fadeIn();
-               } else {
-                       hostField.parents('.form-group').fadeIn();
-                       if (hostField.val() === 'localhost') {
-                               hostField.val('127.0.0.1');
-                       }
-                       portField.parents('.form-group').fadeIn();
-                       socketField.parents('.form-group').fadeOut();
-               }
+       $('#t3js-connect-database-driver').on('change', function() {
+               var driver = $(this).val();
+               $('.t3-install-driver-data').hide();
+               $('.t3-install-driver-data input').attr('disabled', 'disabled');
+               $('#' + driver + ' input').attr('disabled', false);
+               $('#' + driver).show();
        }).trigger('change');
 
        // Extension compatibility check
@@ -1039,7 +1026,6 @@ TYPO3.Install.upgradeAnalysis = {
 
        showFilterManager: function () {
                $(document).on('click', '#t3js-showFilterManager', function () {
-                       console.log('click!');
                        var classOpen = 'display_open';
                        if ($('#t3js-showFilterManager').hasClass(classOpen)) {
                                $('#t3js-showFilterManager').removeClass(classOpen);