[TASK] Remove mis-usage of TemplateService->fileHash 97/57197/3
authorBenni Mack <benni@typo3.org>
Tue, 12 Jun 2018 09:09:56 +0000 (11:09 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 12 Jun 2018 13:56:27 +0000 (15:56 +0200)
The fileHash property acts as an internal cache for
TemplateService->getFileName() and was misued since TYPO3 6.0 for
FAL-related information of processed images.

As this is a purely runtime-based cache (and internal), the usages here
are dropped.

Resolves: #85235
Releases: master
Change-Id: I96e8630cb8c45be009385aa5eccc01e3875e2d2b
Reviewed-on: https://review.typo3.org/57197
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extbase/Classes/Service/ImageService.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index d5eead2..9af886f 100644 (file)
@@ -173,9 +173,8 @@ class ImageService implements \TYPO3\CMS\Core\SingletonInterface
     protected function setCompatibilityValues(ProcessedFile $processedImage)
     {
         if ($this->environmentService->isEnvironmentInFrontendMode()) {
-            $imageInfo = $this->getCompatibilityImageResourceValues($processedImage);
-            $GLOBALS['TSFE']->lastImageInfo = $imageInfo;
-            $GLOBALS['TSFE']->imagesOnPage[] = $imageInfo[3];
+            $GLOBALS['TSFE']->lastImageInfo = $this->getCompatibilityImageResourceValues($processedImage);
+            $GLOBALS['TSFE']->imagesOnPage[] = $processedImage->getPublicUrl();
         }
     }
 
@@ -189,24 +188,17 @@ class ImageService implements \TYPO3\CMS\Core\SingletonInterface
      */
     protected function getCompatibilityImageResourceValues(ProcessedFile $processedImage)
     {
-        $hash = $processedImage->calculateChecksum();
-        if (isset($GLOBALS['TSFE']->tmpl->fileCache[$hash])) {
-            $compatibilityImageResourceValues = $GLOBALS['TSFE']->tmpl->fileCache[$hash];
-        } else {
-            $compatibilityImageResourceValues = [
-                0 => $processedImage->getProperty('width'),
-                1 => $processedImage->getProperty('height'),
-                2 => $processedImage->getExtension(),
-                3 => $processedImage->getPublicUrl(),
-                'origFile' => $processedImage->getOriginalFile()->getPublicUrl(),
-                'origFile_mtime' => $processedImage->getOriginalFile()->getModificationTime(),
-                // This is needed by \TYPO3\CMS\Frontend\Imaging\GifBuilder,
-                // in order for the setup-array to create a unique filename hash.
-                'originalFile' => $processedImage->getOriginalFile(),
-                'processedFile' => $processedImage,
-                'fileCacheHash' => $hash
-            ];
-        }
-        return $compatibilityImageResourceValues;
+        return [
+            0 => $processedImage->getProperty('width'),
+            1 => $processedImage->getProperty('height'),
+            2 => $processedImage->getExtension(),
+            3 => $processedImage->getPublicUrl(),
+            'origFile' => $processedImage->getOriginalFile()->getPublicUrl(),
+            'origFile_mtime' => $processedImage->getOriginalFile()->getModificationTime(),
+            // This is needed by \TYPO3\CMS\Frontend\Imaging\GifBuilder,
+            // in order for the setup-array to create a unique filename hash.
+            'originalFile' => $processedImage->getOriginalFile(),
+            'processedFile' => $processedImage
+        ];
     }
 }
index d1cf44e..c6d54d9 100644 (file)
@@ -4622,10 +4622,8 @@ class ContentObjectRenderer implements LoggerAwareInterface
                         $processingConfiguration['maskImages']['maskBottomImageMask'] = $bottomImg_mask['processedFile'];
                     }
                     $processedFileObject = $fileObject->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $processingConfiguration);
-                    $hash = $processedFileObject->calculateChecksum();
-                    // store info in the TSFE template cache (kept for backwards compatibility)
-                    if ($processedFileObject->isProcessed() && !isset($tsfe->tmpl->fileCache[$hash])) {
-                        $tsfe->tmpl->fileCache[$hash] = [
+                    if ($processedFileObject->isProcessed()) {
+                        $imageResource = [
                             0 => $processedFileObject->getProperty('width'),
                             1 => $processedFileObject->getProperty('height'),
                             2 => $processedFileObject->getExtension(),
@@ -4635,11 +4633,9 @@ class ContentObjectRenderer implements LoggerAwareInterface
                             // This is needed by \TYPO3\CMS\Frontend\Imaging\GifBuilder,
                             // in order for the setup-array to create a unique filename hash.
                             'originalFile' => $fileObject,
-                            'processedFile' => $processedFileObject,
-                            'fileCacheHash' => $hash
+                            'processedFile' => $processedFileObject
                         ];
                     }
-                    $imageResource = $tsfe->tmpl->fileCache[$hash];
                 }
             }
         }