[TASK] Activate 'Flush system caches' with Preset 'Development' 56/30656/4
authorZbigniew Jacko <z.jacko@macopedia.pl>
Wed, 11 Jun 2014 09:04:46 +0000 (11:04 +0200)
committerXavier Perseguers <xavier@typo3.org>
Wed, 11 Jun 2014 10:11:45 +0000 (12:11 +0200)
Add a new configuration in Install Tool (['SYS']['clearCacheSystem']).
If set, the toolbar of clearing system cache is visible (only for
admin users).

Add it also for Configuration Preset. For Production it is set to FALSE,
for Development it is set to TRUE.

Resolves: #57230
Releases: 6.2
Change-Id: Id45496c6bc1e64b4454ed7ff78e8db1179387b0f
Reviewed-on: https://review.typo3.org/30656
Reviewed-by: Krzysztof Adamczyk
Tested-by: Krzysztof Adamczyk
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
typo3/sysext/backend/Classes/Toolbar/ClearCacheToolbarItem.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Configuration/DefaultConfiguration.php
typo3/sysext/install/Classes/Configuration/Context/CustomPreset.php
typo3/sysext/install/Classes/Configuration/Context/DevelopmentPreset.php
typo3/sysext/install/Classes/Configuration/Context/ProductionPreset.php

index 3ea426e..3d2f0ec 100644 (file)
@@ -100,7 +100,9 @@ class ClearCacheToolbarItem implements ToolbarItemHookInterface {
                // 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
-               if ($backendUser->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment()) {
+               // or if $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] is set (only for admins)
+               if ($backendUser->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment()
+                       || ((bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $backendUser->isAdmin())) {
                        $this->cacheActions[] = array(
                                'id' => 'system',
                                'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE),
index b7f5284..41f93e2 100644 (file)
@@ -7166,7 +7166,8 @@ class DataHandler {
                                break;
                        case 'temp_cached':
                        case 'system':
-                               if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.system')) {
+                               if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.system')
+                                       || ((bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $this->admin)) {
                                        GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->flushCachesInGroup('system');
                                }
                                break;
index 0d6556a..86abdea 100644 (file)
@@ -256,6 +256,7 @@ return array(
                        )
                ),
                'isInitialInstallationInProgress' => FALSE,             // Boolean: If TRUE, the installation is 'in progress'. This value is handled within the install tool step installer internally.
+               'clearCacheSystem' => FALSE,            // Boolean: If set, the toolbar menu entry for clearing system caches (core cache, class cache, etc.) is visible for admin users.
        ),
        'EXT' => array( // Options related to the Extension Management
                'allowGlobalInstall' => FALSE,          // Boolean: If set, global extensions in typo3/ext/ are allowed to be installed, updated and deleted etc.
index a7c2446..351a413 100644 (file)
@@ -42,5 +42,6 @@ class CustomPreset extends Configuration\AbstractCustomPreset implements Configu
                'SYS/enableDeprecationLog' => '',
                'SYS/sqlDebug' => '',
                'SYS/systemLogLevel' => '',
+               'SYS/clearCacheSystem' => '',
        );
 }
index 2a8bce6..000608f 100644 (file)
@@ -54,6 +54,7 @@ class DevelopmentPreset extends Configuration\AbstractPreset {
                'SYS/systemLogLevel' => 0,
                // E_WARNING | E_RECOVERABLE_ERROR | E_DEPRECATED | E_USER_DEPRECATED
                'SYS/exceptionalErrors' => 28674,
+               'SYS/clearCacheSystem' => TRUE,
        );
 
        /**
index 7b79153..6a7332f 100644 (file)
@@ -52,6 +52,7 @@ class ProductionPreset extends Configuration\AbstractPreset {
                'SYS/enableDeprecationLog' => FALSE,
                'SYS/sqlDebug' => 0,
                'SYS/systemLogLevel' => 2,
+               'SYS/clearCacheSystem' => FALSE,
        );
 
        /**