[BUGFIX] Do not fetch pages with pid < 0 in prepareCacheFlush 07/50907/2
authorSteffen Göde <steffen.goede@netresearch.de>
Thu, 11 Feb 2016 14:46:29 +0000 (15:46 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 8 Dec 2016 20:25:45 +0000 (21:25 +0100)
Do not fetch workspace related pages to prepare cache flushing.

Resolves: #73241
Releases: master,7.6,6.2
Change-Id: I49bac4f1289848ded8c74b77fc4473ef925086dd
Reviewed-on: https://review.typo3.org/50907
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index f872bb7..fa38a82 100644 (file)
@@ -7916,11 +7916,11 @@ class DataHandler
                     $pageUid = $uid;
                 }
                 // Builds list of pages on the SAME level as this page (siblings)
-                $res_tmp = $this->databaseConnection->exec_SELECTquery('A.pid AS pid, B.uid AS uid', 'pages A, pages B', 'A.uid=' . (int)$pageUid . ' AND B.pid=A.pid AND B.deleted=0');
+                $res_tmp = $this->databaseConnection->exec_SELECTquery('A.pid AS pid, B.uid AS uid', 'pages A, pages B', 'A.uid=' . (int)$pageUid . ' AND B.pid=A.pid AND B.deleted=0 AND A.pid >= 0');
                 $pid_tmp = 0;
                 while ($row_tmp = $this->databaseConnection->sql_fetch_assoc($res_tmp)) {
                     $pageIdsThatNeedCacheFlush[] = (int)$row_tmp['uid'];
-                    $pid_tmp = $row_tmp['pid'];
+                    $pid_tmp = (int)$row_tmp['pid'];
                     // Add children as well:
                     if ($TSConfig['clearCache_pageSiblingChildren']) {
                         $res_tmp2 = $this->databaseConnection->exec_SELECTquery('uid', 'pages', 'pid=' . (int)$row_tmp['uid'] . ' AND deleted=0');
@@ -7932,7 +7932,9 @@ class DataHandler
                 }
                 $this->databaseConnection->sql_free_result($res_tmp);
                 // Finally, add the parent page as well:
-                $pageIdsThatNeedCacheFlush[] = (int)$pid_tmp;
+                if ($pid_tmp > 0) {
+                    $pageIdsThatNeedCacheFlush[] = $pid_tmp;
+                }
                 // Add grand-parent as well:
                 if ($TSConfig['clearCache_pageGrandParent']) {
                     $res_tmp = $this->databaseConnection->exec_SELECTquery('pid', 'pages', 'uid=' . (int)$pid_tmp);