[TYPO3-core] RFC: bug #549

Wolfgang Klinger wolfgang at stufenlos.net
Mon Feb 27 11:31:16 CET 2006


 *hiya!*

 On Mon, 27 Feb 2006, Franz Holzinger wrote the following:
> Can you please explain this again?
> You have
> 
> DELETE FROM table where uid=345
> 
> and then
> 
> SELECT FROM table where uid=345
> 

 Now I got it, you mean this forceHardDelete stuff... right..

 Third time is a charm. ;-)

 Here's the final patch.
 Please test and approve this one!


 bye
 Wolfgang

-------------- next part --------------
--- TYPO3core/t3lib/class.t3lib_tcemain.php	2006-02-26 11:14:26.000000000 +0100
+++ TYPO3core_testing/t3lib/class.t3lib_tcemain.php	2006-02-27 11:23:57.000000000 +0100
@@ -3075,6 +3075,9 @@
 			if ($noRecordCheck || $this->doesRecordExist($table,$uid,'delete'))	{
 				$this->clear_cache($table,$uid);	// clear cache before deleting the record, else the correct page cannot be identified by clear_cache
 
+				$propArr = $this->getRecordProperties($table, $uid);
+				$pagePropArr = $this->getRecordProperties('pages', $propArr['pid']);
+
 				$deleteRow = $TCA[$table]['ctrl']['delete'];
 				if ($deleteRow && !$forceHardDelete)	{
 					$value = $undeleteRecord ? 0 : 1;
@@ -3113,7 +3116,24 @@
 
 				$state = $undeleteRecord ? 1 : 3;	// 1 means insert, 3 means delete
 				if (!$GLOBALS['TYPO3_DB']->sql_error())	{
-					$this->log($table,$uid,$state,0,0,'');
+					if ($forceHardDelete) {
+						$message = "Record '%s' (%s) was deleted unrecoverable from page '%s' (%s)";
+					}
+					else {
+						$message = $state == 1 ? 
+							"Record '%s' (%s) was restored on page '%s' (%s)" :
+							"Record '%s' (%s) was deleted from page '%s' (%s)";
+					}
+					$this->log($table, $uid, $state, 0, 0,
+								$message, 0,
+								array(
+									$propArr['header'],
+									$table.':'.$uid,
+									$pagePropArr['header'],
+									$propArr['pid']
+									),
+								$propArr['pid']);
+
 				} else {
 					$this->log($table,$uid,$state,0,100,$GLOBALS['TYPO3_DB']->sql_error());
 				}


More information about the TYPO3-team-core mailing list