[BUGFIX] Migrate workspaces tries to upgrade non existing tables 96/23796/6
authorWouter Wolters <typo3@wouterwolters.nl>
Thu, 12 Sep 2013 19:17:02 +0000 (21:17 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 11 Oct 2013 14:14:30 +0000 (16:14 +0200)
The migrate workspaces update wizard task tries to upgrade non
existing tables. Check if table exists before executing the query.

Change-Id: I57855c079a8485537888345b61c9b3f0a17ca492
Resolves: #34246
Releases: 6.2
Reviewed-on: https://review.typo3.org/23796
Reviewed-by: Sascha Egerer
Tested-by: Sascha Egerer
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/install/Classes/Updates/AbstractUpdate.php
typo3/sysext/install/Classes/Updates/MigrateWorkspacesUpdate.php

index f4105cf..fa4e880 100644 (file)
@@ -143,6 +143,20 @@ abstract class AbstractUpdate {
                return $showUpdate != 2 || $result == TRUE;
        }
 
+       /**
+        * Check if given table exists
+        *
+        * @param string $table
+        * @return boolean
+        */
+       public function checkIfTableExists($table) {
+               $databaseTables = $GLOBALS['TYPO3_DB']->admin_get_tables();
+               if (array_key_exists($table, $databaseTables)) {
+                       return TRUE;
+               }
+               return FALSE;
+       }
+
        /**
         * Checks whether updates are required.
         *
index 6eb8f3c..464a1c0 100644 (file)
@@ -366,8 +366,12 @@ class MigrateWorkspacesUpdate extends InstallSysExtsUpdate {
         * @return boolean
         */
        protected function hasElementsOnWorkspace($table, $workspaceId) {
-               $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, 't3ver_wsid=' . intval($workspaceId));
-               $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
+               $count = 0;
+               if ($this->checkIfTableExists($table)) {
+                       $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, 't3ver_wsid=' . intval($workspaceId));
+                       $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
+               }
+
                return $count > 0;
        }