[BUGFIX] Make DBgetDelete() update tstamp on delete by update 86/22286/2
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 18 Apr 2013 15:03:57 +0000 (17:03 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 14 Jul 2013 13:01:38 +0000 (15:01 +0200)
If told to do so by TCA ContentObjectRenderer::DBgetDelete()
will not immediately delete a row but mark it as deleted.
This change updates the tstamp (if that column is configured)
for that "updated" row as well, like on a regular update.

Fixes: #47354
Releases: 6.2, 6.1
Change-Id: I61b9ce7d8608b73cfb974e79d2f9f59e6dc3547a
Reviewed-on: https://review.typo3.org/22286
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index 7df55bb..0ca56b0 100644 (file)
@@ -6913,14 +6913,16 @@ class ContentObjectRenderer {
        public function DBgetDelete($table, $uid, $doExec = FALSE) {
                if (intval($uid)) {
                        if ($GLOBALS['TCA'][$table]['ctrl']['delete']) {
+                               $updateFields = array();
+                               $updateFields[$GLOBALS['TCA'][$table]['ctrl']['delete']] = 1;
+                               if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) {
+                                       $updateFields[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
+                               }
+
                                if ($doExec) {
-                                       return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($uid), array(
-                                               $GLOBALS['TCA'][$table]['ctrl']['delete'] => 1
-                                       ));
+                                       return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($uid), $updateFields);
                                } else {
-                                       return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid=' . intval($uid), array(
-                                               $GLOBALS['TCA'][$table]['ctrl']['delete'] => 1
-                                       ));
+                                       return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid=' . intval($uid), $updateFields);
                                }
                        } else {
                                if ($doExec) {