[TASK] Doctrine: Migrate admin_get_tables in AbstractUpdate 00/49700/4
authorGeorg Ringer <georg.ringer@gmail.com>
Thu, 1 Sep 2016 06:47:36 +0000 (08:47 +0200)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Thu, 1 Sep 2016 07:58:38 +0000 (09:58 +0200)
Migrate AbstractUpdate

Resolves: #77731
Releases: master
Change-Id: I23f74693513ffbc62e9b84ef519ffc01acf4dd72
Reviewed-on: https://review.typo3.org/49700
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Bamboo TYPO3com <info@typo3.com>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/install/Classes/Updates/AbstractUpdate.php

index 4f8549e..26a2576 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Install\Updates;
  */
 
 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
+use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Registry;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Install\Controller\Action\Tool\UpgradeWizard;
@@ -147,11 +148,12 @@ abstract class AbstractUpdate
      */
     public function checkIfTableExists($table)
     {
-        $databaseTables = $this->getDatabaseConnection()->admin_get_tables();
-        if (array_key_exists($table, $databaseTables)) {
-            return true;
-        }
-        return false;
+        $tableExists = GeneralUtility::makeInstance(ConnectionPool::class)
+            ->getConnectionForTable($table)
+            ->getSchemaManager()
+            ->tablesExist([$table]);
+
+        return $tableExists;
     }
 
     /**
@@ -224,12 +226,4 @@ abstract class AbstractUpdate
 
         return $done;
     }
-
-    /**
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }