diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php index 24da0fab5a0285d11a42734a3e8b17d75fb47b42..cc0afd75719ef9ff8bc4e8ea36885fb3196df3a9 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php @@ -67,16 +67,12 @@ class ClearCacheToolbarItem implements ToolbarItemInterface $this->optionValues[] = 'pages'; } - // Clearing of system cache (core cache, class cache etc) - // is only shown explicitly if activated for a BE-user (not activated for admins by default) - // or if the system runs in development mode (only for admins) - // or if $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] is set (only for admins) - if ($backendUser->getTSConfigVal('options.clearCache.all') - || (GeneralUtility::getApplicationContext()->isDevelopment() && $backendUser->isAdmin()) - || ((bool)$GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === true && $backendUser->isAdmin()) - ) { + // Clearing of all caches is only shown if explicitly enabled via TSConfig + // or if BE-User is admin and the TSconfig explicitly disables the possibility for admins. + // This is useful for big production systems where admins accidentally could slow down the system. + if ($backendUser->getTSConfigVal('options.clearCache.all') || ($backendUser->isAdmin() && $backendUser->getTSConfigVal('options.clearCache.all') !== '0')) { $this->cacheActions[] = array( - 'id' => 'system', + 'id' => 'all', 'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushAllCachesTitle2')), 'description' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushAllCachesDescription2')), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'all']), diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index ccba87fbe2cbaa5c149c839a8fbb68427145c1dc..b811a968b0c722bf8554e4bb6d9135f38f1d2324 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -7812,7 +7812,10 @@ class DataHandler } break; case 'all': - if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.all')) { + // allow to clear all caches if the TS config option is enabled or the option is not explicitly + // disabled for admins (which could clear all caches by default). The latter option is useful + // for big production sites where it should be possible to restrict the cache clearing for some admins. + if ($this->BE_USER->getTSConfigVal('options.clearCache.all') || ($this->admin && $this->BE_USER->getTSConfigVal('options.clearCache.all') !== '0')) { $this->getCacheManager()->flushCaches(); GeneralUtility::makeInstance(ConnectionPool::class) ->getConnectionForTable('cache_treelist') @@ -7826,11 +7829,9 @@ class DataHandler case 'system': GeneralUtility::deprecationLog( 'Calling clear_cacheCmd() with arguments \'temp_cached\' or \'system\', using' - . ' the ts config option \'options.clearCache.system\' or using' - . '\'$GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'clearCacheSystem\'] has been deprecated.' + . ' the TS config option \'options.clearCache.system\' has been deprecated.' ); - if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.system') - || ((bool)$GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === true && $this->admin)) { + if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.system')) { $this->getCacheManager()->flushCachesInGroup('system'); } break; diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index e723eda17541ceee964b695585ca0555bd8a1eb6..ea2057fce99f3c3882467cb6114fa1d355aa9bc1 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -104,7 +104,7 @@ return array( 'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, 'backend' => \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, 'options' => array(), - 'groups' => array('pages', 'all') + 'groups' => array('pages') ), 'cache_pages' => array( 'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, @@ -112,7 +112,7 @@ return array( 'options' => array( 'compression' => true ), - 'groups' => array('pages', 'all') + 'groups' => array('pages') ), 'cache_pagesection' => array( 'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, @@ -121,7 +121,7 @@ return array( 'compression' => true, 'defaultLifetime' => 2592000, // 30 days; set this to a lower value in case your cache gets too big ), - 'groups' => array('pages', 'all') + 'groups' => array('pages') ), 'cache_phpcode' => array( 'frontend' => \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, @@ -143,7 +143,7 @@ return array( 'options' => array( 'defaultLifetime' => 2592000, // 30 days; set this to a lower value in case your cache gets too big ), - 'groups' => array('pages', 'all') + 'groups' => array('pages') ), 'cache_imagesizes' => array( 'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-75625-DeprecatedCacheClearingOptions.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-75625-DeprecatedCacheClearingOptions.rst index 4738673f285bad3e6aa163a24ddf80c1df6ae179..60df0ffcefa44498d030a2326ec7ad8a0e1d9534 100644 --- a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-75625-DeprecatedCacheClearingOptions.rst +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-75625-DeprecatedCacheClearingOptions.rst @@ -9,7 +9,7 @@ The following commands have been deprecated and should not be used anymore: * Method :php:`DataHandler->clear_cacheCmd()` with arguments `system` and `temp_cached` * ``userTSconfig`` setting ``options.clearCache.system`` -* Option ``$TYPO3_CONF_VARS['SYS']['clearCacheSystem']`` +* Option ``$TYPO3_CONF_VARS['SYS']['clearCacheSystem']`` has been removed Impact