diff --git a/Build/Resources/Public/Less/TYPO3/_topbar.less b/Build/Resources/Public/Less/TYPO3/_topbar.less index 721a063d56d29e31e9634534e71d195698009433..988f38de4f8b6bfb1fad7c50e7be2df8dd6f5192 100644 --- a/Build/Resources/Public/Less/TYPO3/_topbar.less +++ b/Build/Resources/Public/Less/TYPO3/_topbar.less @@ -297,6 +297,12 @@ background-color: @brand-danger; color: @btn-danger-color; } + small { + white-space: normal; + width: 270px; + display: block; + padding-left: 21px; + } } .dropdown-list-link-edit, .dropdown-list-link-delete, diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php index 43f089e3c2964352b8ba4f3e99b7471c5484ab0e..4faa057338edeff301df13e83cea151952250a32 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php @@ -67,24 +67,11 @@ class ClearCacheToolbarItem implements ToolbarItemInterface $this->optionValues[] = 'pages'; } - // Clear cache for ALL tables! - if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.all')) { - $this->cacheActions[] = array( - 'id' => 'all', - 'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle')), - 'description' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription')), - 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'all']), - 'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-medium', Icon::SIZE_SMALL)->render() - ); - $this->optionValues[] = 'all'; - } - // 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.system') + if ($backendUser->getTSConfigVal('options.clearCache.all') || (GeneralUtility::getApplicationContext()->isDevelopment() && $backendUser->isAdmin()) || ((bool)$GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === true && $backendUser->isAdmin()) ) { @@ -92,10 +79,10 @@ class ClearCacheToolbarItem implements ToolbarItemInterface 'id' => 'system', 'title' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle')), 'description' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription')), - 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'system']), + 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'all']), 'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-high', Icon::SIZE_SMALL)->render() ); - $this->optionValues[] = 'system'; + $this->optionValues[] = 'all'; } // Hook for manipulating cacheActions @@ -156,8 +143,9 @@ class ClearCacheToolbarItem implements ToolbarItemInterface foreach ($this->cacheActions as $cacheAction) { $title = $cacheAction['description'] ?: $cacheAction['title']; $result[] = '<li>'; - $result[] = '<a class="dropdown-list-link" href="' . htmlspecialchars($cacheAction['href']) . '" title="' . htmlspecialchars($title) . '">'; + $result[] = '<a class="dropdown-list-link" href="' . htmlspecialchars($cacheAction['href']) . '">'; $result[] = $cacheAction['icon'] . ' ' . htmlspecialchars($cacheAction['title']); + $result[] = '<br/><small>' . htmlspecialchars($title) . '</small>'; $result[] = '</a>'; $result[] = '</li>'; } diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js index 572754174bc97f35bcde222cde59886926db3af4..8a4790e76db31b0d02ddd116d0ec9f6c2a371f45 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js @@ -16,7 +16,7 @@ * main functionality for clearing caches via the top bar * reloading the clear cache icon */ -define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) { +define(['jquery', 'TYPO3/CMS/Backend/Icons', 'TYPO3/CMS/Backend/Notification'], function($, Icons, Notification) { 'use strict'; /** @@ -67,8 +67,11 @@ define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) { url: ajaxUrl, type: 'post', cache: false, - complete: function() { + complete: function(jqXHRObject, status) { $(ClearCacheMenu.options.toolbarIconSelector, ClearCacheMenu.options.containerSelector).replaceWith($existingIcon); + if (status !== 'success' || jqXHRObject.responseText !== '') { + Notification.error('An error occurs', 'An error occured while clearing the cache. It is likely not all caches were cleared as expected.', 0); + } } }); }; diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index 36152195224000d13a888da1373a4b7a2fea8fec..d315f3758699c5e59bb5ed7abd8bdd9256ccdb43 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -27,14 +27,17 @@ use TYPO3\CMS\Core\Html\RteHtmlParser; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Messaging\FlashMessageService; use TYPO3\CMS\Core\Resource\ResourceFactory; +use TYPO3\CMS\Core\Service\OpcodeCacheService; use TYPO3\CMS\Core\Type\Bitmask\Permission; use TYPO3\CMS\Core\Utility\ArrayUtility; +use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\File\BasicFileUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Utility\PathUtility; use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Core\Versioning\VersionState; +use TYPO3\CMS\Install\Service\ClearCacheService; /** * The main data handler class which takes care of correctly updating and inserting records. @@ -7803,7 +7806,6 @@ class DataHandler if (is_object($this->BE_USER)) { $this->BE_USER->writelog(3, 1, 0, 0, 'User %s has cleared the cache (cacheCmd=%s)', array($this->BE_USER->user['username'], $cacheCmd)); } - // Clear cache for either ALL pages or ALL tables! switch (strtolower($cacheCmd)) { case 'pages': if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.pages')) { @@ -7812,11 +7814,13 @@ class DataHandler break; case 'all': if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.all')) { - // Clear cache group "all" of caching framework caches - $this->getCacheManager()->flushCachesInGroup('all'); + // Delete typo3temp/var/Cache manually as quick, straight and brutal approach here + GeneralUtility::flushDirectory(PATH_site . 'typo3temp/var/Cache', true, true); + $this->getCacheManager()->flushCaches(); $this->databaseConnection->exec_TRUNCATEquery('cache_treelist'); + // Delete Opcode Cache + GeneralUtility::makeInstance(OpcodeCacheService::class)->clearAllActive(); } - break; case 'temp_cached': case 'system': diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-75581-SimplifyCacheClearing.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-75581-SimplifyCacheClearing.rst new file mode 100644 index 0000000000000000000000000000000000000000..85f9167a95acc39df4c444ff9ee122661dc987af --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-75581-SimplifyCacheClearing.rst @@ -0,0 +1,18 @@ +========================================= +Feature: #75581 - Simplify cache clearing +========================================= + +Description +=========== + +The cache clearing system has been simplified by removing options in cache clear menu and install tool. + +The cache clear menu in the backend contains now only two options: + +* Flush frontend caches + Clear frontend and page-related caches, like before. + +* Flush all caches + Clear all system-related caches, including the class loader, localization, extension configuration file caches and opcode caches. Rebuilding this cache may take some time. + +Within the install tool the "Clear all cache" button will clear now also the opcode caches if possible. diff --git a/typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php b/typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php index 08e364589f9731e13ddd1acf598b6a2d0e52fd11..38150e9f8633e98d66a935d09a8d11a7a072f75e 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php +++ b/typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php @@ -48,8 +48,6 @@ class ImportantActions extends Action\AbstractAction } if (isset($this->postValues['set']['clearAllCache'])) { $actionMessages[] = $this->clearAllCache(); - } - if (isset($this->postValues['set']['clearOpcodeCache'])) { $actionMessages[] = $this->clearOpcodeCache(); } diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/ImportantActions/ClearAllCache.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/ImportantActions/ClearAllCache.html index ad95b71980dcd5a1f2f152fc96d79e0ba227525f..befbd292b0b3c95627f5bcd38a37899c5e3a451a 100644 --- a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/ImportantActions/ClearAllCache.html +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/ImportantActions/ClearAllCache.html @@ -7,7 +7,22 @@ This method can throw a fatal error if a broken extension is loaded. If you get a white page or a PHP error message, check your system with the broken extension test below. </p> +<p> + This clears the complete opcode caches of the active opcode cache systems, if the system supports reset. +</p> +<p>Available PHP opcode cache systems</p> +<ul> + <f:for each="{listOfOpcodeCaches}" as="opcodeCache" key="opcodeCacheName"> + <li>{opcodeCacheName} ({opcodeCache.version}) - + <f:if condition="{opcodeCache.canReset}"> + <f:then>reset is supported</f:then> + <f:else>reset is not supported</f:else> + </f:if> + </li> + </f:for> +</ul> + <form method="post"> <f:render partial="Action/Common/HiddenFormFields" arguments="{_all}" /> - <f:render partial="Action/Common/SubmitButton" arguments="{name:'clearAllCache', text:'Clear all cache'}"/> + <f:render partial="Action/Common/SubmitButton" arguments="{name:'clearAllCache', text:'Clear all caches including PHP opcode cache'}"/> </form> diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/ImportantActions/ClearOpcodeCache.html b/typo3/sysext/install/Resources/Private/Partials/Action/Tool/ImportantActions/ClearOpcodeCache.html deleted file mode 100644 index d0ba283215f9b3b9dc1a742751a7a2c0200890ba..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Private/Partials/Action/Tool/ImportantActions/ClearOpcodeCache.html +++ /dev/null @@ -1,22 +0,0 @@ -<f:if condition="{listOfOpcodeCaches}"> - <h3>Clear PHP opcode cache</h3> - <p> - This clears the complete opcode caches of the active opcode cache systems, if the system supports reset. - </p> - <p>Available PHP opcode cache systems</p> - <ul> - <f:for each="{listOfOpcodeCaches}" as="opcodeCache" key="opcodeCacheName"> - <li>{opcodeCacheName} ({opcodeCache.version}) - - <f:if condition="{opcodeCache.canReset}"> - <f:then>reset is supported</f:then> - <f:else>reset is not supported</f:else> - </f:if> - </li> - </f:for> - </ul> - <form method="post"> - <f:render partial="Action/Common/HiddenFormFields" arguments="{_all}" /> - <f:render partial="Action/Common/SubmitButton" arguments="{name:'clearOpcodeCache', text:'Clear PHP opcode cache'}"/> - </form> - <hr /> -</f:if> diff --git a/typo3/sysext/install/Resources/Private/Templates/Action/Tool/ImportantActions.html b/typo3/sysext/install/Resources/Private/Templates/Action/Tool/ImportantActions.html index 0304331af2dd7d85984c613fb551420851ee6e1b..1be9d69ec4dc7630cb580c7224f18ea9eaa2e4e8 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Action/Tool/ImportantActions.html +++ b/typo3/sysext/install/Resources/Private/Templates/Action/Tool/ImportantActions.html @@ -25,8 +25,6 @@ <f:render partial="Action/Tool/ImportantActions/ClearAllCache" arguments="{_all}"/> <hr /> - <f:render partial="Action/Tool/ImportantActions/ClearOpcodeCache" arguments="{_all}"/> - <f:render partial="Action/Tool/ImportantActions/ExtensionCompatibilityTester" arguments="{_all}"/> <hr /> diff --git a/typo3/sysext/lang/locallang_core.xlf b/typo3/sysext/lang/locallang_core.xlf index 9b49d5efd36a38a90751d63c956ae91c45c98734..1a1650c71cdf7f770e615a20a171dd4609de9c67 100644 --- a/typo3/sysext/lang/locallang_core.xlf +++ b/typo3/sysext/lang/locallang_core.xlf @@ -876,10 +876,10 @@ Do you want to refresh it now?</source> <source>Clear frontend and page-related caches, plus some backend-related caches.</source> </trans-unit> <trans-unit id="flushSystemCachesTitle"> - <source>Flush system caches</source> + <source>Flush all caches</source> </trans-unit> <trans-unit id="flushSystemCachesDescription"> - <source>Clear all system-related caches, including the class loader, localization and extension configuration file caches. Rebuilding this cache may take some time. </source> + <source>Clear all system-related caches, including the class loader, localization, extension configuration file caches and opcode caches. Rebuilding this cache may take some time.</source> </trans-unit> <trans-unit id="rm.adminFunctions"> <source>Admin functions</source> diff --git a/typo3/sysext/t3skin/Resources/Public/Css/backend.css b/typo3/sysext/t3skin/Resources/Public/Css/backend.css index d22624d936a11ec10afb6d46234cdec560c2de2c..96b90b2c198dfd86f92fee63cb3e6c79c024be52 100644 --- a/typo3/sysext/t3skin/Resources/Public/Css/backend.css +++ b/typo3/sysext/t3skin/Resources/Public/Css/backend.css @@ -12578,6 +12578,12 @@ iframe { background-color: #c83c3c; color: #ffffff; } +.typo3-topbar-navigation-items .dropdown-list-link small { + white-space: normal; + width: 270px; + display: block; + padding-left: 21px; +} .typo3-topbar-navigation-items .dropdown-list-link-edit, .typo3-topbar-navigation-items .dropdown-list-link-delete, .typo3-topbar-navigation-items .dropdown-list-link-close {