[BUGFIX] Clear_cache() must not consider page ids lower than 0 79/23079/3
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:29:20 +0000 (17:29 +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/23079
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index ed36804..cad6d75 100644 (file)
@@ -6692,7 +6692,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