From b5e0245e4210953dee66ccd752d3a3f533ce16c4 Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Thu, 19 Jul 2018 12:01:17 +0200 Subject: [PATCH] [TASK] Deprecate enableConcatenateFiles Also config.concatenateJsAndCss TypoScript is replaced with concatenateCss and concatenateJs since TYPO3 v6.0, and can now be deprecated. Resolves: #65578 Releases: master Change-Id: I23ee9637a3c880c67a93a6f9771a9bfab5ed6ac3 Reviewed-on: https://review.typo3.org/57629 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Daniel Goerz <ervaude@gmail.com> Tested-by: Daniel Goerz <ervaude@gmail.com> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> --- .../Classes/Template/DocumentTemplate.php | 3 +- .../sysext/core/Classes/Page/PageRenderer.php | 10 ++++- ...concatenateJsAndCssAndConcatenateFiles.rst | 38 +++++++++++++++++++ .../frontend/Classes/Page/PageGenerator.php | 5 ++- .../Php/MethodCallMatcher.php | 21 ++++++++++ 5 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-65578-ConfigconcatenateJsAndCssAndConcatenateFiles.rst diff --git a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php index 713a0b5b2cb1..eed884d1f2a4 100644 --- a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php +++ b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php @@ -297,7 +297,8 @@ function jumpToUrl(URL) { } $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $this->pageRenderer->setLanguage($GLOBALS['LANG']->lang); - $this->pageRenderer->enableConcatenateFiles(); + $this->pageRenderer->enableConcatenateCss(); + $this->pageRenderer->enableConcatenateJavascript(); $this->pageRenderer->enableCompressCss(); $this->pageRenderer->enableCompressJavascript(); // Add all JavaScript files defined in $this->jsFiles to the PageRenderer diff --git a/typo3/sysext/core/Classes/Page/PageRenderer.php b/typo3/sysext/core/Classes/Page/PageRenderer.php index 420a9c67dba5..e564dc6b2cbe 100644 --- a/typo3/sysext/core/Classes/Page/PageRenderer.php +++ b/typo3/sysext/core/Classes/Page/PageRenderer.php @@ -59,6 +59,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface /** * @var bool + * @deprecated will be removed in TYPO3 v10, in favor of concatenateJavaScript and concatenateCss */ protected $concatenateFiles = false; @@ -635,17 +636,21 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface /** * Enables concatenation of js and css files + * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0 */ public function enableConcatenateFiles() { + trigger_error('This method will be removed in TYPO3 v10.0. Use concatenateCss() and concatenateJavascript() instead.', E_USER_DEPRECATED); $this->concatenateFiles = true; } /** * Disables concatenation of js and css files + * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0 */ public function disableConcatenateFiles() { + trigger_error('This method will be removed in TYPO3 v10.0. Use concatenateCss() and concatenateJavascript() instead.', E_USER_DEPRECATED); $this->concatenateFiles = false; } @@ -705,7 +710,8 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface { $this->compressJavascript = false; $this->compressCss = false; - $this->concatenateFiles = false; + $this->concatenateCss = false; + $this->concatenateJavascript = false; $this->removeLineBreaksFromTemplate = false; $this->enableJqueryDebug = true; } @@ -860,9 +866,11 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface * Gets concatenate of js and css files * * @return bool + * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0 */ public function getConcatenateFiles() { + trigger_error('This method will be removed in TYPO3 v10.0. Use concatenateCss() and concatenateJavascript() instead.', E_USER_DEPRECATED); return $this->concatenateFiles; } diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65578-ConfigconcatenateJsAndCssAndConcatenateFiles.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65578-ConfigconcatenateJsAndCssAndConcatenateFiles.rst new file mode 100644 index 000000000000..b4571693fc0a --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65578-ConfigconcatenateJsAndCssAndConcatenateFiles.rst @@ -0,0 +1,38 @@ +.. include:: ../../Includes.txt + +===================================================================== +Deprecation: #65578 - config.concatenateJsAndCss and concatenateFiles +===================================================================== + +See :issue:`65578` + +Description +=========== + +The TypoScript property `config.concatenateJsAndCss` and the related methods within :php:`PageRenderer` have +been marked as deprecated: + +* :php:`PageRenderer->getConcatenateFiles()` +* :php:`PageRenderer->enableConcatenateFiles()` +* :php:`PageRenderer->disableConcatenateFiles()` + + +Impact +====== + +Setting the TypoScript property or calling one of the methods above will trigger a deprecation log entry. + + +Affected Installations +====================== + +TYPO3 installations setting the TypoScript property or calling one of the PHP methods directly. + + +Migration +========= + +Use the TypoScript properties :typoscript:`config.concatenateJs = 1` and :typoscript:`config.concatenateCss = 1` +and the corresponding methods in PageRenderer class directly instead. + +.. index:: Frontend, PHP-API, TypoScript, PartiallyScanned \ No newline at end of file diff --git a/typo3/sysext/frontend/Classes/Page/PageGenerator.php b/typo3/sysext/frontend/Classes/Page/PageGenerator.php index 911d2d822d6a..7efb062797e6 100644 --- a/typo3/sysext/frontend/Classes/Page/PageGenerator.php +++ b/typo3/sysext/frontend/Classes/Page/PageGenerator.php @@ -779,8 +779,11 @@ class PageGenerator $pageRenderer->enableConcatenateJavascript(); } // Backward compatibility for old configuration + // @deprecated - remove this option in TYPO3 v10.0. if ($tsfe->config['config']['concatenateJsAndCss']) { - $pageRenderer->enableConcatenateFiles(); + trigger_error('Setting config.concatenateJsAndCss is deprecated in favor of config.concatenateJs and config.concatenateCss, and will have no effect anymore in TYPO3 v10.0.', E_USER_DEPRECATED); + $pageRenderer->enableConcatenateCss(); + $pageRenderer->enableConcatenateJavascript(); } // Add header data block if ($tsfe->additionalHeaderData) { diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php index 7d98d5d14f6a..c612d84454d5 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php @@ -2452,4 +2452,25 @@ return [ 'Deprecation-84387-DeprecatedMethodAndPropertyInSchedulerModuleController.rst', ], ], + 'TYPO3\CMS\Core\Page\PageRenderer->enableConcatenateFiles' => [ + 'numberOfMandatoryArguments' => 0, + 'maximumNumberOfArguments' => 0, + 'restFiles' => [ + 'Deprecation-65578-ConfigconcatenateJsAndCssAndConcatenateFiles.rst', + ], + ], + 'TYPO3\CMS\Core\Page\PageRenderer->getConcatenateFiles' => [ + 'numberOfMandatoryArguments' => 0, + 'maximumNumberOfArguments' => 0, + 'restFiles' => [ + 'Deprecation-65578-ConfigconcatenateJsAndCssAndConcatenateFiles.rst', + ], + ], + 'TYPO3\CMS\Core\Page\PageRenderer->disableConcatenateFiles' => [ + 'numberOfMandatoryArguments' => 0, + 'maximumNumberOfArguments' => 0, + 'restFiles' => [ + 'Deprecation-65578-ConfigconcatenateJsAndCssAndConcatenateFiles.rst', + ], + ], ]; -- GitLab