From 863530cb6eb2c177cb2d933b4bca8156ebf38fd4 Mon Sep 17 00:00:00 2001 From: Oliver Bartsch <bo@cedev.de> Date: Wed, 18 Jan 2023 11:03:05 +0100 Subject: [PATCH] [TASK] Deprecate flushByTag hook The hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_cache_frontend_abstractfrontend.php']['flushByTag'] is deprecated, since it contradicts the recommended way for custom cache functionality, which is to implement a custom cache frontend using the corresponding Frontend API. Resolves: #99592 Releases: main Change-Id: Idb158c29408d5335774986adfb351e231f855a9d Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77464 Tested-by: core-ci <typo3@b13.com> Reviewed-by: Benjamin Franzke <bfr@qbus.de> Tested-by: Oliver Hader <oliver.hader@typo3.org> Reviewed-by: Oliver Bartsch <bo@cedev.de> Tested-by: Oliver Bartsch <bo@cedev.de> Tested-by: Benjamin Franzke <bfr@qbus.de> Reviewed-by: Oliver Hader <oliver.hader@typo3.org> Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> --- .../Cache/Frontend/AbstractFrontend.php | 9 +++++ ...ecation-99592-DeprecatedFlushByTagHook.rst | 36 +++++++++++++++++++ .../Php/ArrayDimensionMatcher.php | 5 +++ 3 files changed, 50 insertions(+) create mode 100644 typo3/sysext/core/Documentation/Changelog/12.2/Deprecation-99592-DeprecatedFlushByTagHook.rst diff --git a/typo3/sysext/core/Classes/Cache/Frontend/AbstractFrontend.php b/typo3/sysext/core/Classes/Cache/Frontend/AbstractFrontend.php index 3bc421d424bb..72f2cf8f6dc5 100644 --- a/typo3/sysext/core/Classes/Cache/Frontend/AbstractFrontend.php +++ b/typo3/sysext/core/Classes/Cache/Frontend/AbstractFrontend.php @@ -141,6 +141,15 @@ abstract class AbstractFrontend implements FrontendInterface throw new \InvalidArgumentException('"' . $tag . '" is not a valid tag for a cache entry.', 1233057359); } + if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_cache_frontend_abstractfrontend.php']['flushByTag']) + && count($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_cache_frontend_abstractfrontend.php']['flushByTag']) > 0 + ) { + trigger_error( + 'The hook "t3lib/cache/frontend/class.t3lib_cache_frontend_abstractfrontend.php" "flushByTag" has been marked as deprecated and will be removed with TYPO3 v13. Use a custom frontend instead.', + E_USER_DEPRECATED + ); + } + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_cache_frontend_abstractfrontend.php']['flushByTag'] ?? [] as $_funcRef) { $params = ['tag' => $tag]; GeneralUtility::callUserFunction($_funcRef, $params, $this); diff --git a/typo3/sysext/core/Documentation/Changelog/12.2/Deprecation-99592-DeprecatedFlushByTagHook.rst b/typo3/sysext/core/Documentation/Changelog/12.2/Deprecation-99592-DeprecatedFlushByTagHook.rst new file mode 100644 index 000000000000..5260d252f921 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/12.2/Deprecation-99592-DeprecatedFlushByTagHook.rst @@ -0,0 +1,36 @@ +.. include:: /Includes.rst.txt + +.. _deprecation-99592-1674033859: + +================================================== +Deprecation: #99592 - Deprecated "flushByTag" hook +================================================== + +See :issue:`99592` + +Description +=========== + +The hook :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_cache_frontend_abstractfrontend.php']['flushByTag']` +has been marked as deprecated, since the recommended way for custom cache +functionality is to implement a custom cache frontend, using the +:ref:`Frontend API<t3coreapi:caching-frontend>`. + +Impact +====== + +Any hook implementation registered won't be executed anymore +in TYPO3 v13. The extension scanner will report possible usages. + +Affected installations +====================== + +All installations making use of the deprecated hook. + +Migration +========= + +Migrate corresponding functionality in the :php:`flushByTag()` method of your +own cache frontend implementation. + +.. index:: PHP-API, FullyScanned, ext:core diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php index 1edb3099de19..e95ba373d609 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php @@ -956,4 +956,9 @@ return [ 'Deprecation-99586-RegistrationOfUpgradeWizardsViaGLOBALS.rst', ], ], + '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'t3lib/cache/frontend/class.t3lib_cache_frontend_abstractfrontend.php\'][\'flushByTag\']' => [ + 'restFiles' => [ + 'Deprecation-99592-DeprecatedFlushByTagHook.rst', + ], + ], ]; -- GitLab