[BUGFIX] Clear_cache() must not consider page ids lower than 0 78/23078/5
authorOliver Hader <oliver@typo3.org>
Fri, 11 Oct 2013 12:30:53 +0000 (14:30 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Fri, 11 Oct 2013 15:24:16 +0000 (17:24 +0200)
DataHandler::clear_cache() is called with a table and an uid that
has been modified to trigger the clear cache commands. To find
siblings, children, parents, etc. the pid value is directly used
to find the affected pages. However, in a workspace context, the
pid is always "-1" which leads to a selection of all page
records of all workspaces. This amount is used to flush all
defined caches by a given tag name and might result in execution
time outs.

To avoid these superfluous cache flushes, page ids lower than 0
are ignored now in this section.

Fixes: #51051
Releases: 6.0, 6.1, 6.2
Change-Id: I03987bbd8c5d3526fb4dfda75b0dd0316fe1d836
Reviewed-on: https://review.typo3.org/23078
Reviewed-by: Sascha Egerer
Tested-by: Sascha Egerer
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index 52089c5..d6f4f65 100644 (file)
@@ -6871,7 +6871,12 @@ class DataHandler {
                                        if (is_array($list_cache)) {
                                                $pageIds = $GLOBALS['TYPO3_DB']->cleanIntArray($list_cache);
                                                foreach ($pageIds as $pageId) {
-                                                       $GLOBALS['typo3CacheManager']->flushCachesByTag('pageId_' . $pageId);
+                                                       // Workspaces always use "-1" as the page id which do not
+                                                       // point to real pages and caches at all. Flushing caches for
+                                                       // those records does not make sense and decreases performance
+                                                       if ($pageId >= 0) {
+                                                               $GLOBALS['typo3CacheManager']->flushCachesByTag('pageId_' . $pageId);
+                                                       }
                                                }
                                        }
                                        // Delete cache for current table and record