[BUGFIX] Avoid DBAL\Exception on unknown data type in Install Tool 07/52907/2
authorStephan Großberndt <stephan@grossberndt.de>
Fri, 19 May 2017 06:35:30 +0000 (08:35 +0200)
committerBenni Mack <benni@typo3.org>
Mon, 22 May 2017 16:58:58 +0000 (18:58 +0200)
Using $connection->getSchemaManager()->listTableNames() instead of
->listTables() in Install Tool prevents a DBAL\Exception as the table
details are not requested - which are not used anyway, so this is
faster too.

Releases: master, 8.7
Resolves: #81264
Change-Id: I35db1b6fa743ad4869bf2ba24717320f0f009995
Reviewed-on: https://review.typo3.org/52907
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php
typo3/sysext/install/Classes/Service/ClearCacheService.php

index 7831cb5..8f5c49d 100644 (file)
@@ -97,7 +97,7 @@ class ImportantActions extends Action\AbstractAction
                 'host' => $connection->getHost(),
                 'port' => $connection->getPort(),
                 'socket' => $connectionParameters['unix_socket'] ?? '',
-                'numberOfTables' => count($connection->getSchemaManager()->listTables()),
+                'numberOfTables' => count($connection->getSchemaManager()->listTableNames()),
                 'numberOfMappedTables' => 0,
             ];
             if (isset($GLOBALS['TYPO3_CONF_VARS']['DB']['TableMapping'])
index b2c7170..3fa24e0 100644 (file)
@@ -49,10 +49,10 @@ class ClearCacheService
         // Get all table names from Default connection starting with 'cf_' and truncate them
         $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
         $connection = $connectionPool->getConnectionByName('Default');
-        $tables = $connection->getSchemaManager()->listTables();
-        foreach ($tables as $table) {
-            if (strpos($table->getName(), 'cf_') === 0 || $table->getName() === 'cache_treelist') {
-                $connection->truncate($table->getName());
+        $tableNames = $connection->getSchemaManager()->listTableNames();
+        foreach ($tableNames as $tableName) {
+            if (strpos($tableName, 'cf_') === 0 || $tableName === 'cache_treelist') {
+                $connection->truncate($tableName);
             }
         }