From b46dcbf3ee5d8552d8202d36cacf7bf60974781e Mon Sep 17 00:00:00 2001 From: Benni Mack Date: Fri, 24 Aug 2018 18:14:04 +0200 Subject: [PATCH] [TASK] Deprecate cObject FILE The cObject FILE has a strange behaviour, and rather became low-level since Fluid's rise in rendering Frontend. FILE shows an image if the file is jpg,jpeg,gif,png (but not SVG), and if has a different file ending, it will check if the file is less than 1MB, it will get its contents and output that. If the file is 1 byte bigger, nothing is done. This _magic_ is sketchy, and obsolete, as Fluid offers more flexibility nowadays. Thus, cObject FILE will be removed from TYPO3 Core in v10.0, however due to the flexibility of custom cObject, an extension author could just re-implement the functionality in a custom extension within minutes. Resolves: #85970 Releases: master Change-Id: I792ec89486e29051da478c5ec0855d2f9cf913a1 Reviewed-on: https://review.typo3.org/58028 Reviewed-by: Anja Leichsenring Tested-by: Anja Leichsenring Tested-by: TYPO3com Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn --- .../Deprecation-85970-FileContentObject.rst | 57 +++++++++++++++++++ .../ContentObject/FileContentObject.php | 2 + 2 files changed, 59 insertions(+) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-85970-FileContentObject.rst diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85970-FileContentObject.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85970-FileContentObject.rst new file mode 100644 index 00000000000..07bfaaa94d5 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85970-FileContentObject.rst @@ -0,0 +1,57 @@ +.. include:: ../../Includes.txt + +========================================= +Deprecation: #85970 - FILE content object +========================================= + +See :issue:`85970` + +Description +=========== + +The cObject FILE is mixing concerns (rendering an image, or dumping file contents), and +rather became low-level since Fluid's rise in rendering Frontend. + +FILE shows an image if the file is jpg,jpeg,gif,png (but not SVG), and if has a +different file ending, it will check if the file is less than 1MB, it will get its contents +and output that. If the file is 1 byte bigger, nothing is done. +Fluid offers more flexibility nowadays. + +Thus, cObject FILE will be removed in TYPO3 v10. + + +Impact +====== + +Instances using the TypoScript cObject :typoscript:`FILE` will find PHP :php:`E_USER_DEPRECATED` errors for each usage. + + +Affected Installations +====================== + +Instances using the TypoScript cObject :typoscript:`FILE`. + + +Migration +========= + +Use :typoscript:`IMAGE` to show images instead. + +For realising :typoscript:`TEMPLATE`, migrate to using :typoscript:`FLUIDTEMPLATE`. It comes with all +the benefits Fluid offers. + +However due to the flexibility of custom cObject, an extension author could just re-implement +the functionality in a custom extension within minutes. +See this example for ext:frontend where the registration resides in :file:`ext_localconf.php`. + +.. codeblock:: php + + $GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects'] = array_merge( + $GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects'], + [ + 'FILE' => \TYPO3\CMS\Frontend\ContentObject\FileContentObject::class, + ], + ); + + +.. index:: TypoScript, NotScanned diff --git a/typo3/sysext/frontend/Classes/ContentObject/FileContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/FileContentObject.php index e370119a423..c2fae01da99 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/FileContentObject.php +++ b/typo3/sysext/frontend/Classes/ContentObject/FileContentObject.php @@ -21,6 +21,7 @@ use TYPO3\CMS\Frontend\Resource\FilePathSanitizer; /** * Contains FILE class object. + * @deprecated FILE cObject will be removed in TYPO3 v10.0. */ class FileContentObject extends AbstractContentObject { @@ -32,6 +33,7 @@ class FileContentObject extends AbstractContentObject */ public function render($conf = []) { + $this->getTypoScriptFrontendController()->logDeprecatedTyposcript('cObject FILE', 'Use IMAGE to show images instead.'); $theValue = ''; $file = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file']; try { -- 2.20.1