[BUGFIX] Upgrade Wizard "Split menu types.." fails 58/51858/7
authorThomas Hohn <thomas@hohn.dk>
Sat, 25 Feb 2017 16:11:24 +0000 (17:11 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Mon, 27 Feb 2017 12:56:59 +0000 (13:56 +0100)
Show warning if table tt_content doesn't have column
menu_type instead of SQL error.

Resolves: #79813
Releases: master
Change-Id: Ibb6e260f45e65c2fc563be129d2da43c05a9eaf6
Reviewed-on: https://review.typo3.org/51858
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Philipp Gampe <philipp.gampe@typo3.org>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/install/Classes/Updates/SplitMenusUpdate.php

index 1813bd2..6a11527 100644 (file)
@@ -39,6 +39,12 @@ class SplitMenusUpdate extends AbstractUpdate
         if ($this->isWizardDone()) {
             return false;
         }
+        $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tt_content');
+        $tableColumns = $connection->getSchemaManager()->listTableColumns('tt_content');
+        // Only proceed if menu_type field still exists
+        if (!isset($tableColumns['menu_type'])) {
+            return false;
+        }
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content');
         $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
         $elementCount = $queryBuilder->count('uid')