From a35062a1eba5c6c15f703686cd4fecc5536d74df Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 15 Apr 2010 02:33:30 -0400
Subject: [PATCH] Always set changed date when marking a DB record as deleted + provide a cleanup script
---
program/include/rcube_contacts.php | 18 ++++--------------
1 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/program/include/rcube_contacts.php b/program/include/rcube_contacts.php
index dd37972..b8307d4 100644
--- a/program/include/rcube_contacts.php
+++ b/program/include/rcube_contacts.php
@@ -403,16 +403,10 @@
if (is_array($ids))
$ids = join(',', $ids);
- // delete all group members linked with these contacts
- if ($this->groups) {
- $this->db->query(
- "DELETE FROM ".get_table_name('contactgroupmembers')."
- WHERE contact_id IN (".$ids.")");
- }
-
+ // flag record as deleted
$this->db->query(
"UPDATE ".$this->db_name."
- SET del=1
+ SET del=1, changed=".$this->db->now()."
WHERE user_id=?
AND contact_id IN (".$ids.")",
$this->user_id);
@@ -456,18 +450,14 @@
}
/**
- * Delete the given group and all linked group members
+ * Delete the given group (and all linked group members)
*
* @param string Group identifier
* @return boolean True on success, false if no data was changed
*/
function delete_group($gid)
{
- $sql_result = $this->db->query(
- "DELETE FROM ".get_table_name('contactgroupmembers')."
- WHERE contactgroup_id=?",
- $gid);
-
+ // flag group record as deleted
$sql_result = $this->db->query(
"UPDATE ".get_table_name('contactgroups')."
SET del=1, changed=".$this->db->now()."
--
Gitblit v1.9.1