Fixed bug #6954: Bug: History/undo information disappears after publication (Thanks...
authorBenni Mack <benni.mack@typo3.org>
Sun, 15 Nov 2009 22:57:52 +0000 (22:57 +0000)
committerBenni Mack <benni.mack@typo3.org>
Sun, 15 Nov 2009 22:57:52 +0000 (22:57 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6422 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tcemain.php

index d77e2ed..77c0291 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-15  Benjamin Mack  <benni@typo3.org>
+
+       * Fixed bug #6954: Bug: History/undo information disappears after publication (Thanks to Tolleiv Nietsch)
+
 2009-11-15  Steffen Kamper  <info@sk-typo3.de>
 
        * Fixed bug #12588: Bugfix: db_list_extra->makeLocalizationPanel doesn't consider the backPath (Thanks to Tolleiv Nietsch)
index e1ed26d..790986e 100644 (file)
@@ -4780,6 +4780,10 @@ class t3lib_TCEmain      {
                                                                                        // Registering and swapping MM relations in current and swap records:
                                                                                $this->version_remapMMForVersionSwap($table,$id,$swapWith);
 
+                                                                                       // Generating proper history data to prepare logging
+                                                                               $this->compareFieldArrayWithCurrentAndUnset($table, $id, $swapVersion);
+                                                                               $this->compareFieldArrayWithCurrentAndUnset($table, $swapWith, $curVersion);
+
                                                                                        // Execute swapping:
                                                                                $sqlErrors = array();
                                                                                $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table,'uid='.intval($id),$swapVersion);
@@ -4813,9 +4817,29 @@ class t3lib_TCEmain      {
 
                                                                                        $this->newlog2(($swapIntoWS ? 'Swapping' : 'Publishing').' successful for table "'.$table.'" uid '.$id.'=>'.$swapWith, $table, $id, $swapVersion['pid']);
 
-                                                                                               // Update reference index:
+                                                                                               // Update reference index of the live record:
                                                                                        $this->updateRefIndex($table,$id);
+                                                                                               // Set log entry for live record:
+                                                                                       $propArr = $this->getRecordPropertiesFromRow($table, $swapVersion);
+                                                                                       if ( $propArr['_ORIG_pid'] == -1) {
+                                                                                               $label = $GLOBALS['LANG']->sL ('LLL:EXT:lang/locallang_tcemain.xml:version_swap.offline_record_updated');
+                                                                                       } else {
+                                                                                               $label = $GLOBALS['LANG']->sL ('LLL:EXT:lang/locallang_tcemain.xml:version_swap.online_record_updated');
+                                                                                       }
+                                                                                       $theLogId = $this->log($table, $id, 2, $propArr['pid'], 0, $label , 10, array($propArr['header'], $table . ':' . $id), $propArr['event_pid']);
+                                                                                       $this->setHistory($table, $id, $theLogId);
+
+                                                                                               // Update reference index of the offline record:
                                                                                        $this->updateRefIndex($table,$swapWith);
+                                                                                               // Set log entry for offline record:
+                                                                                       $propArr = $this->getRecordPropertiesFromRow($table, $curVersion);
+                                                                                       if ( $propArr['_ORIG_pid'] == -1) {
+                                                                                               $label = $GLOBALS['LANG']->sL ('LLL:EXT:lang/locallang_tcemain.xml:version_swap.offline_record_updated');
+                                                                                       } else {
+                                                                                               $label = $GLOBALS['LANG']->sL ('LLL:EXT:lang/locallang_tcemain.xml:version_swap.online_record_updated');
+                                                                                       }
+                                                                                       $theLogId = $this->log($table, $swapWith, 2, $propArr['pid'], 0, $label , 10, array($propArr['header'], $table . ':'. $swapWith), $propArr['event_pid']);
+                                                                                       $this->setHistory($table, $swapWith, $theLogId);
 
                                                                                                // SWAPPING pids for subrecords:
                                                                                        if ($table=='pages' && $swapVersion['t3ver_swapmode']>=0)       {