[BUGFIX] Uncaught exception in Install tool 61/51861/7
authorThomas Hohn <thomas@hohn.dk>
Sun, 26 Feb 2017 15:05:33 +0000 (16:05 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Mon, 27 Feb 2017 12:47:43 +0000 (13:47 +0100)
Fixes an uncaught exception in the Install tool if the file
ext_tables_static+adt.sql contains invalid CREATE TABLE
statements.

Resolves: #80025
Releases: master
Change-Id: I8417b34c944f359feb16f5e44277b61fb289eea1
Reviewed-on: https://review.typo3.org/51861
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php

index 81c9a16..88c193e 100644 (file)
@@ -260,7 +260,7 @@ class SchemaMigrator
             } catch (StatementException $statementException) {
                 // Enrich the error message with the full invalid statement
                 throw new StatementException(
-                    $statementException->getMessage() . ' in statement ' . $statement,
+                    $statementException->getMessage() . ' in statement: ' . LF . $statement,
                     1476171315,
                     $statementException
                 );
index 60deb48..7099ce7 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
 use Doctrine\DBAL\DBALException;
 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
 use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Database\Schema\Exception\StatementException;
 use TYPO3\CMS\Core\Database\Schema\SchemaMigrator;
 use TYPO3\CMS\Core\Database\Schema\SqlReader;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -61,8 +62,19 @@ class DatabaseData extends AbstractStepAction
             $configurationManager->setLocalConfigurationValueByPath('SYS/sitename', $postValues['sitename']);
         }
 
-        $result = $this->importDatabaseData();
-        if (!empty($result)) {
+        try {
+            $result = $this->importDatabaseData();
+            if (!empty($result)) {
+                return $result;
+            }
+        } catch (StatementException $exception) {
+            $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
+            $errorStatus->setTitle('Import of database data could not be performed');
+            $errorStatus->setMessage(
+                'Error detected in SQL statement:' . LF .
+                $exception->getMessage()
+            );
+            $result[] = $errorStatus;
             return $result;
         }