[TASK] Simplify ImageCropUpdater 92/51792/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Wed, 22 Feb 2017 08:51:35 +0000 (09:51 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 22 Feb 2017 10:37:35 +0000 (11:37 +0100)
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>
typo3/sysext/install/Classes/Updates/RowUpdater/ImageCropUpdater.php

index c1d69d1..1d99eed 100644 (file)
@@ -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
@@ -30,16 +29,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()
      *
@@ -48,18 +37,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
      *
      * @return string
@@ -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) {
             }