[TYPO3-core] RFC: bug #549
Wolfgang Klinger
wolfgang at stufenlos.net
Mon Feb 27 10:57:05 CET 2006
*hiya!*
New patch attached.
On Mon, 27 Feb 2006, Franz Holzinger wrote the following:
> > * @param integer Normally 0 (zero). If set, it
> > indicates that this log-entry is used to notify the backend of a
> > record which is moved to another location
I set that parameter to '0'.
> > $page_propArr
>
> this kind of naming is not wanted here.
Do you like $pagePropArr more?
> You have the line
>
> > $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'uid='.intval($uid));
>
> which will call:
>
> > function DELETEquery($table,$where) {
> > if (is_string($where)) {
> >
> > // Table and fieldnames should be "SQL-injection-safe"
> > when supplied to this function
> > $query = 'DELETE FROM '.$table.
> > (strlen($where)>0 ? '
> > WHERE
> > '.$where : '');
> >
>
>
> And after it you have coded:
>
> > $propArr = $this->getRecordProperties($table, $uid);
>
> which will call
>
> > function recordInfo($table,$id,$fieldList) {
> > global $TCA;
> > if (is_array($TCA[$table])) {
> > $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fieldList,
> > $table, 'uid='.intval($id));
> > if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
> > return $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
> > }
> > }
> > }
>
>
> So how should this work when the record with this uid has already been
> deleted before?
It works because all the methods do not check if the deleted flag is
set, I tried it out before posting this patch here,
you didn't obviously.
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 10:50:13.000000000 +0100
@@ -3113,7 +3113,21 @@
$state = $undeleteRecord ? 1 : 3; // 1 means insert, 3 means delete
if (!$GLOBALS['TYPO3_DB']->sql_error()) {
- $this->log($table,$uid,$state,0,0,'');
+ $propArr = $this->getRecordProperties($table, $uid);
+ $pagePropArr = $this->getRecordProperties('pages', $propArr['pid']);
+ $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