From ad451fca299bbc53b190591e1ff20af447c6700d Mon Sep 17 00:00:00 2001 From: Georg Ringer <georg.ringer@gmail.com> Date: Mon, 20 Jun 2016 22:07:38 +0200 Subject: [PATCH] [FEATURE] Clear cache of selected page in context menu Add an entry in the context menu of the page tree to clear the cache of the selected page. Resolves: #20446 Releases: master Change-Id: I1b8c7e8ed0166f7b83c9409aabf9e80245fe6799 Reviewed-on: https://review.typo3.org/48618 Tested-by: Bamboo TYPO3com <info@typo3.com> Reviewed-by: Joerg Boesche <typo3@joergboesche.de> Tested-by: Joerg Boesche <typo3@joergboesche.de> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: Wouter Wolters <typo3@wouterwolters.nl> --- .../Tree/Pagetree/ExtdirectTreeCommands.php | 14 ++++++++++++++ .../components/pagetree/javascript/actions.js | 12 ++++++++++++ .../core/Configuration/DefaultConfiguration.php | 10 ++++++++++ .../Feature-20446-ClearCacheEntryInContextMenu.rst | 8 ++++++++ 4 files changed, 44 insertions(+) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Feature-20446-ClearCacheEntryInContextMenu.rst diff --git a/typo3/sysext/backend/Classes/Tree/Pagetree/ExtdirectTreeCommands.php b/typo3/sysext/backend/Classes/Tree/Pagetree/ExtdirectTreeCommands.php index 33a0e35dc312..95b2301e9766 100644 --- a/typo3/sysext/backend/Classes/Tree/Pagetree/ExtdirectTreeCommands.php +++ b/typo3/sysext/backend/Classes/Tree/Pagetree/ExtdirectTreeCommands.php @@ -156,6 +156,20 @@ class ExtdirectTreeCommands return $returnValue; } + /** + * Clear cache of the page + * + * @param \stdClass $nodeData + * @return void + */ + public static function clearCacheOfPage($nodeData) + { + $node = GeneralUtility::makeInstance(PagetreeNode::class, (array)$nodeData); + $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class); + $tce->start(array(), array()); + $tce->clear_cacheCmd($node->getId()); + } + /** * Sets a temporary mount point * diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/extjs/components/pagetree/javascript/actions.js b/typo3/sysext/backend/Resources/Public/JavaScript/extjs/components/pagetree/javascript/actions.js index 4d8bb05f11c8..75ad1c0fdca8 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/extjs/components/pagetree/javascript/actions.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/extjs/components/pagetree/javascript/actions.js @@ -689,6 +689,18 @@ TYPO3.Components.PageTree.Actions = { ); }, + /** + * Clear cache of a page + * + * @param {Ext.tree.TreeNode} node + * @return {void} + */ + clearCacheOfPage: function(node) { + TYPO3.Components.PageTree.Commands.clearCacheOfPage( + node.attributes.nodeData + ); + }, + /** * Reloads the content frame with the current module and node id * diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index 92819f7c4c67..3107b6ac3de1 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -964,6 +964,16 @@ return array( displayCondition = canBeRemoved != 0 && isMountPoint != 1 callbackAction = removeNode } + + 1100 = DIVIDER + + 1200 = ITEM + 1200 { + name = clearCache + label = LLL:EXT:lang/locallang_core.xlf:labels.clear_cache + iconName = actions-system-cache-clear + callbackAction = clearCacheOfPage + } } 1000 = SUBMENU diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-20446-ClearCacheEntryInContextMenu.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-20446-ClearCacheEntryInContextMenu.rst new file mode 100644 index 000000000000..25d7d9f0f3ff --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-20446-ClearCacheEntryInContextMenu.rst @@ -0,0 +1,8 @@ +=================================================== +Feature: #20446 - Clear cache entry in context menu +=================================================== + +Description +=========== + +A new entry has been added in the context menu of the page tree to be able to clear the cache of the selected page. The entry is located inside "Page Actions". \ No newline at end of file -- GitLab