From a9fdf915a046862f80731386b3d65d2d19f328ea Mon Sep 17 00:00:00 2001 From: Nalmar Date: Tue, 12 Aug 2025 14:50:22 -0400 Subject: [PATCH] Allows vhs cache configuration to be overridden by additionnal.php while keeping extension defaults for non-overridden values --- ext_localconf.php | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/ext_localconf.php b/ext_localconf.php index a302af213..e8e0f0e59 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -13,26 +13,24 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'][] = \FluidTYPO3\Vhs\Service\AssetService::class . '->clearCacheCommand'; } - if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vhs_main'] ?? null)) { - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vhs_main'] = [ - 'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, - 'options' => [ - 'defaultLifetime' => 804600 - ], - 'groups' => ['pages', 'all'] - ]; - } - - if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vhs_markdown'] ?? null)) { - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vhs_markdown'] = [ - 'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, - 'options' => [ - // You should keep this value HIGHER than the lifetime of TYPO3's page caches at all times. - 'defaultLifetime' => 804600 - ], - 'groups' => ['pages', 'all'] - ]; - } + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vhs_main'] ??= []; + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vhs_main'] += [ + 'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, + 'options' => [ + 'defaultLifetime' => 804600 + ], + 'groups' => ['pages', 'all'] + ]; + + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vhs_markdown'] ??= []; + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vhs_markdown'] += [ + 'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, + 'options' => [ + // You should keep this value HIGHER than the lifetime of TYPO3's page caches at all times. + 'defaultLifetime' => 804600 + ], + 'groups' => ['pages', 'all'] + ]; $GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['namespaces']['v'] = ['FluidTYPO3\\Vhs\\ViewHelpers'];