From d0a249120c51de9b3fe4d975abfcf909c77ef1cf Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Wed, 22 Feb 2017 09:51:35 +0100
Subject: [PATCH] [TASK] Simplify ImageCropUpdater

The ImageCropUpdater of the install tool does not need the
not-yet-migrated TCA it does not rely on any TCA that may
have changed. Remove that section from the code.

Change-Id: I8ed4190fd53d87f368c978b183b99b562dba9444
Resolves: #79951
Releases: master
Reviewed-on: https://review.typo3.org/51792
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Tested-by: Helmut Hummel <typo3@helhum.io>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Updates/RowUpdater/ImageCropUpdater.php   | 27 +------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/typo3/sysext/install/Classes/Updates/RowUpdater/ImageCropUpdater.php b/typo3/sysext/install/Classes/Updates/RowUpdater/ImageCropUpdater.php
index c1d69d19992f..1d99eed28ef0 100644
--- a/typo3/sysext/install/Classes/Updates/RowUpdater/ImageCropUpdater.php
+++ b/typo3/sysext/install/Classes/Updates/RowUpdater/ImageCropUpdater.php
@@ -21,7 +21,6 @@ use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
-use TYPO3\CMS\Install\Service\LoadTcaService;
 
 /**
  * Migrate values for database records having columns
@@ -29,16 +28,6 @@ use TYPO3\CMS\Install\Service\LoadTcaService;
  */
 class ImageCropUpdater implements RowUpdaterInterface
 {
-    /**
-     * @var array Full, migrated TCA as prepared by upgrade wizard controller
-     */
-    protected $migratedTca;
-
-    /**
-     * @var array Full, but NOT migrated TCA
-     */
-    protected $notMigratedTca;
-
     /**
      * List of tables with information about to migrate fields.
      * Created during hasPotentialUpdateForTable(), used in updateTableRow()
@@ -47,18 +36,6 @@ class ImageCropUpdater implements RowUpdaterInterface
      */
     protected $payload = [];
 
-    /**
-     * Prepare non-migrated TCA to be used in 'hasPotentialUpdateForTable' step
-     */
-    public function __construct()
-    {
-        $this->migratedTca = $GLOBALS['TCA'];
-        $loadTcaService = GeneralUtility::makeInstance(LoadTcaService::class);
-        $loadTcaService->loadExtensionTablesWithoutMigration();
-        $this->notMigratedTca = $GLOBALS['TCA'];
-        $GLOBALS['TCA'] = $this->migratedTca;
-    }
-
     /**
      * Get title
      *
@@ -77,14 +54,12 @@ class ImageCropUpdater implements RowUpdaterInterface
      */
     public function hasPotentialUpdateForTable(string $tableName): bool
     {
-        $GLOBALS['TCA'] = $this->notMigratedTca;
         $result = false;
         $payload = $this->getPayloadForTable($tableName);
         if (count($payload) !== 0) {
             $this->payload[$tableName] = $payload;
             $result = true;
         }
-        $GLOBALS['TCA'] = $this->migratedTca;
         return $result;
     }
 
@@ -217,7 +192,7 @@ class ImageCropUpdater implements RowUpdaterInterface
         }
         if (MathUtility::canBeInterpretedAsInteger($fileUid)) {
             try {
-                $file = ResourceFactory::getInstance()->getFileObject($fileUid);
+                $file = ResourceFactory::getInstance()->getFileObject((int)$fileUid);
             } catch (FileDoesNotExistException $e) {
             } catch (\InvalidArgumentException $e) {
             }
-- 
GitLab