[!!!][TASK] Gifbuilder: Always use full filename of original file as prefix 15/34015/7
authorGeorg Ringer <georg.ringer@gmail.com>
Wed, 12 Nov 2014 14:41:12 +0000 (15:41 +0100)
committerBenjamin Mack <benni@typo3.org>
Fri, 23 Jan 2015 16:47:25 +0000 (17:47 +0100)
As of now, images created with GIFBUILDER were created by a
hash in typo3temp/GB/. With the TypoScript option
config.meaningfulTempFilePrefix it was possible to prepend the
first X characters of the original filename in the filename.
This was due to some FS limitations on Windows.

With FAL the option was not used anymore, but Gifbuilder
still used this option.

In order to streamline the generation of temporary
files, images created by the Gifbuilder now contain
the full filename of the original file as well.

The TypoScript option "config.meaningfulTempFilePrefix"
has no effect anymore now.

Resolves: #62886
Releases: master
Change-Id: I746aa5d8c2e483212c28419dadb68a5cd5d1282d
Reviewed-on: http://review.typo3.org/34015
Reviewed-by: Eric Chavaillaz <eric@hemmer.ch>
Tested-by: Eric Chavaillaz <eric@hemmer.ch>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/core/Documentation/Changelog/master/Breaking-62886-RemoveMeaningfulTempFilePrefix.rst [new file with mode: 0644]
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Classes/Imaging/GifBuilder.php
typo3/sysext/t3editor/res/tsref/tsref.xml

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-62886-RemoveMeaningfulTempFilePrefix.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-62886-RemoveMeaningfulTempFilePrefix.rst
new file mode 100644 (file)
index 0000000..62c9321
--- /dev/null
@@ -0,0 +1,26 @@
+==================================================================
+Breaking: #62886 - Removed setting config.meaningfulTempFilePrefix
+==================================================================
+
+Description
+===========
+
+The setting *config.meaningfulTempFilePrefix* which was still used for images built by GIFBUILDER and put in
+typo3temp/GB/ was removed. With this option it was possible to configure a meaningful file prefix limiting
+the filename prefix to a certain character length.
+
+Impact
+======
+
+All files will always have their original filename fully prepended in the folder typo3temp/GB/.
+
+Affected Installations
+======================
+
+All installations using GIFBUILDER to generate images. The files within typo3temp/GB/ will now be called
+with the full name of each original file before the hash and the file extension.
+
+Migration
+=========
+
+The setting can be removed from any TypoScript configuration because there is no impact anymore.
\ No newline at end of file
index ffc4d44..0859168 100644 (file)
@@ -5360,9 +5360,6 @@ class ContentObjectRenderer {
                                                $processingConfiguration['maskImages']['maskBottomImage'] = $bottomImg['processedFile'];
                                                $processingConfiguration['maskImages']['maskBottomImageMask'] = $bottomImg_mask['processedFile'];
                                        }
-                                       if ($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']) {
-                                               $processingConfiguration['useTargetFileNameAsPrefix'] = 1;
-                                       }
                                        $processedFileObject = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $processingConfiguration);
                                        $hash = $processedFileObject->calculateChecksum();
                                        // store info in the TSFE template cache (kept for backwards compatibility)
index 42d11bb..c17b0e1 100644 (file)
@@ -676,33 +676,21 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
 
        /**
         * Calculates the GIFBUILDER output filename/path based on a serialized, hashed value of this->setup
+        * and prefixes the original filename
+        * also, the filename gets an additional prefix (max 100 characters),
+        * something like "GB_MD5HASH_myfilename_is_very_long_and_such.jpg"
         *
         * @param string $pre Filename prefix, eg. "GB_
         * @return string The relative filepath (relative to PATH_site)
         * @access private
         */
        public function fileName($pre) {
-               $meaningfulPrefix = '';
-               if ($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']) {
-                       /** @var $basicFileFunctions \TYPO3\CMS\Core\Utility\File\BasicFileUtility */
-                       $basicFileFunctions = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\File\BasicFileUtility::class);
-                       $meaningfulPrefix = implode('_', array_merge($this->combinedTextStrings, $this->combinedFileNames));
-                       $meaningfulPrefix = $basicFileFunctions->cleanFileName($meaningfulPrefix);
-                       $meaningfulPrefixLength = (int)$GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix'];
-                       if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
-                               /** @var $t3libCsInstance \TYPO3\CMS\Core\Charset\CharsetConverter */
-                               $t3libCsInstance = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Charset\CharsetConverter::class);
-                               $meaningfulPrefix = $t3libCsInstance->substr('utf-8', $meaningfulPrefix, 0, $meaningfulPrefixLength);
-                       } else {
-                               $meaningfulPrefix = substr($meaningfulPrefix, 0, $meaningfulPrefixLength);
-                       }
-                       $meaningfulPrefix .= '_';
-               }
-               // WARNING: In PHP5 I discovered that rendering with freetype of Japanese letters was totally corrupt.
-               // Not only the wrong glyphs are printed but also some memory stack overflow resulted in strange additional
-               // chars - and finally the reason for this investigation: The Bounding box data was changing all the time
-               // resulting in new images being generated all the time. With PHP4 it works fine.
-               return $this->tempPath . $pre . $meaningfulPrefix . GeneralUtility::shortMD5(serialize($this->setup)) . '.' . $this->extension();
+               /** @var $basicFileFunctions \TYPO3\CMS\Core\Utility\File\BasicFileUtility */
+               $basicFileFunctions = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\BasicFileUtility');
+               $filePrefix = implode('_', array_merge($this->combinedTextStrings, $this->combinedFileNames));
+               $filePrefix = $basicFileFunctions->cleanFileName($filePrefix);
+
+               return $this->tempPath . $pre . $filePrefix . '_' . GeneralUtility::shortMD5(serialize($this->setup)) . '.' . $this->extension();
        }
 
        /**
index 26e2bb6..74d9d1a 100644 (file)
@@ -686,12 +686,6 @@ Used by "filelist" in stdWrap]]></description>
                        <description><![CDATA[This lets you specify an alternative "mainScript" which is the document that TYPO3 expects to be the default doc. This is used in form-tags and other places where TYPO3 needs to refer directly to the main-script of the application]]></description>
                        <default><![CDATA[index.php]]></default>
                </property>
-               <property name="meaningfulTempFilePrefix" type="boolean">
-                       <description><![CDATA[If set it will try to render a meaningful prefix before temporary image files.
-Works with GIFBUILDER files (taking content from the Gifbuilder TEXT objects), menus (taking the title of the menu item) and scaled images (using original filename base).]]></description>
-                       <default><![CDATA[
-]]></default>
-               </property>
                <property name="message_page_is_being_generated" type="string">
                        <description><![CDATA[Alternative HTML message that appears if a page is being generated.
 Normally when a page is being generated a temporary copy is stored in the cache-table with an expire-time of 30 seconds.