[BUGFIX] Perform rollback only once if undeleting CE with History/Undo 65/54065/2
authorLukasz Uznanski <l.uznanski@macopedia.pl>
Thu, 7 Sep 2017 19:19:15 +0000 (21:19 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 9 Sep 2017 14:42:36 +0000 (16:42 +0200)
Releases: master, 8.7
Resolves: #81649
Change-Id: I1cb9a681b46327af56c2cb080c92b3cc273b0e10
Reviewed-on: https://review.typo3.org/54065
Reviewed-by: Joerg Kummer <typo3@enobe.de>
Tested-by: Joerg Kummer <typo3@enobe.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/History/RecordHistory.php

index 27dca8e..f5c67e5 100644 (file)
@@ -253,38 +253,40 @@ class RecordHistory
                 $reloadPageFrame = 1;
             }
         }
-        // PROCESS CHANGES
-        // create an array for process_datamap
-        $diffModified = [];
-        foreach ($diff['oldData'] as $key => $value) {
-            $splitKey = explode(':', $key);
-            $diffModified[$splitKey[0]][$splitKey[1]] = $value;
-        }
-        switch (count($rollbackData)) {
-            case 1:
-                // all tables
-                $data = $diffModified;
-                break;
-            case 2:
-                // one record
-                $data[$rollbackData[0]][$rollbackData[1]] = $diffModified[$rollbackData[0]][$rollbackData[1]];
-                break;
-            case 3:
-                // one field in one record
-                $data[$rollbackData[0]][$rollbackData[1]][$rollbackData[2]] = $diffModified[$rollbackData[0]][$rollbackData[1]][$rollbackData[2]];
-                break;
-        }
-        // Removing fields:
-        $data = $this->removeFilefields($rollbackData[0], $data);
-        // Writes the data:
-        $tce = GeneralUtility::makeInstance(DataHandler::class);
-        $tce->debug = 0;
-        $tce->dontProcessTransformations = 1;
-        $tce->start($data, []);
-        $tce->process_datamap();
-        unset($tce);
-        if (isset($data['pages'])) {
-            $reloadPageFrame = 1;
+        if (!$diff['insertsDeletes']) {
+            // PROCESS CHANGES
+            // create an array for process_datamap
+            $diffModified = [];
+            foreach ($diff['oldData'] as $key => $value) {
+                $splitKey = explode(':', $key);
+                $diffModified[$splitKey[0]][$splitKey[1]] = $value;
+            }
+            switch (count($rollbackData)) {
+                case 1:
+                    // all tables
+                    $data = $diffModified;
+                    break;
+                case 2:
+                    // one record
+                    $data[$rollbackData[0]][$rollbackData[1]] = $diffModified[$rollbackData[0]][$rollbackData[1]];
+                    break;
+                case 3:
+                    // one field in one record
+                    $data[$rollbackData[0]][$rollbackData[1]][$rollbackData[2]] = $diffModified[$rollbackData[0]][$rollbackData[1]][$rollbackData[2]];
+                    break;
+            }
+            // Removing fields:
+            $data = $this->removeFilefields($rollbackData[0], $data);
+            // Writes the data:
+            $tce = GeneralUtility::makeInstance(DataHandler::class);
+            $tce->debug = 0;
+            $tce->dontProcessTransformations = 1;
+            $tce->start($data, []);
+            $tce->process_datamap();
+            unset($tce);
+            if (isset($data['pages'])) {
+                $reloadPageFrame = 1;
+            }
         }
         // Return to normal operation
         $this->lastSyslogId = false;