From 54306301476c2e5e93ee4ba8183f9362896bd6e1 Mon Sep 17 00:00:00 2001
From: Thomas Hohn <thomas@hohn.dk>
Date: Sat, 25 Feb 2017 17:11:24 +0100
Subject: [PATCH] [BUGFIX] Upgrade Wizard "Split menu types.." fails

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 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/typo3/sysext/install/Classes/Updates/SplitMenusUpdate.php b/typo3/sysext/install/Classes/Updates/SplitMenusUpdate.php
index 1813bd288fd0..6a1152770f94 100644
--- a/typo3/sysext/install/Classes/Updates/SplitMenusUpdate.php
+++ b/typo3/sysext/install/Classes/Updates/SplitMenusUpdate.php
@@ -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')
-- 
GitLab