From 2bdbb2bac765812666d2d2a2f8d68b4b6486098d Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Sun, 26 Feb 2017 17:15:02 +0100
Subject: [PATCH] [BUGFIX] Install tool upgrade wizards fail on postgres

Controller class UpgradeWizard of install tool method performUpdate()
calls getDatabaseConnection() (old TYPO3_DB) and connects. This was
done in the past to receive the list of executed queries during
upgrade and is now implemented in the single upgrade classes directly.

If running postgres, the connect attempt of old database class tries
to connect to a mysql instance and runs into a timeout.

Remove this TYPO3_DB left over from the install tool to successfully
execute upgrade wizards on non-mysql platforms.

Change-Id: Ia87ae4bce1c4f4992527f0fa6fbddebdb6e3733c
Resolves: #80026
Releases: master
Reviewed-on: https://review.typo3.org/51862
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../Controller/Action/AbstractAction.php      | 24 -------------------
 .../Controller/Action/Tool/UpgradeWizard.php  |  4 ----
 2 files changed, 28 deletions(-)

diff --git a/typo3/sysext/install/Classes/Controller/Action/AbstractAction.php b/typo3/sysext/install/Classes/Controller/Action/AbstractAction.php
index 5b69dcbeac51..2e75b8b163f7 100644
--- a/typo3/sysext/install/Classes/Controller/Action/AbstractAction.php
+++ b/typo3/sysext/install/Classes/Controller/Action/AbstractAction.php
@@ -186,30 +186,6 @@ abstract class AbstractAction implements ActionInterface
         return $context;
     }
 
-    /**
-     * Get database instance.
-     * Will be initialized if it does not exist yet.
-     *
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        static $database;
-        if (!is_object($database)) {
-            /** @var \TYPO3\CMS\Core\Database\DatabaseConnection $database */
-            $database = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
-            $database->setDatabaseUsername($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user']);
-            $database->setDatabasePassword($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password']);
-            $database->setDatabaseHost($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host']);
-            $database->setDatabasePort($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['port']);
-            $database->setDatabaseSocket($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['unix_socket']);
-            $database->setDatabaseName($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname']);
-            $database->initialize();
-            $database->connectDB();
-        }
-        return $database;
-    }
-
     /**
      * Some actions like the database analyzer and the upgrade wizards need additional
      * bootstrap actions performed.
diff --git a/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php b/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
index 05b0f1a2c61f..fc8fd6c6737b 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
@@ -284,8 +284,6 @@ class UpgradeWizard extends Action\AbstractAction
      */
     protected function performUpdate()
     {
-        $this->getDatabaseConnection()->store_lastBuiltQuery = true;
-
         $wizardIdentifier = $this->postValues['values']['identifier'];
         $className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][$wizardIdentifier];
         $updateObject = $this->getUpdateObjectInstance($className, $wizardIdentifier);
@@ -336,8 +334,6 @@ class UpgradeWizard extends Action\AbstractAction
 
         $this->view->assign('wizardData', $wizardData);
 
-        $this->getDatabaseConnection()->store_lastBuiltQuery = false;
-
         // Next update wizard, if available
         $nextUpdate = $this->getNextUpdateInstance($updateObject);
         $nextUpdateIdentifier = '';
-- 
GitLab