Skip to content

Commit d4a475c

Browse files
committed
delete spamfilter domain only if domain is changed, update spamfilter_users from mailboxes
1 parent b7fdc6c commit d4a475c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

interface/web/mail/mail_domain_edit.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,13 @@ function onAfterUpdate() {
392392
//* Update the mailget records
393393
$app->db->query("UPDATE mail_get SET destination=REPLACE(destination, '".$app->db->quote($this->oldDataRecord['domain'])."', '".$app->db->quote($this->dataRecord['domain'])."'), sys_userid = $client_user_id, sys_groupid = $sys_groupid WHERE destination LIKE '%@".$app->db->quote($this->oldDataRecord['domain'])."'");
394394

395-
//* Delete the old spamfilter record
396-
$tmp = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($this->oldDataRecord["domain"])."'");
397-
$app->db->datalogDelete('spamfilter_users', 'id', $tmp["id"]);
398-
unset($tmp);
395+
if ($this->oldDataRecord["domain"] != $this->dataRecord['domain']) {
396+
//* Delete the old spamfilter record
397+
$tmp = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($this->oldDataRecord["domain"])."'");
398+
$app->db->datalogDelete('spamfilter_users', 'id', $tmp["id"]);
399+
unset($tmp);
400+
}
401+
$app->db->query("UPDATE spamfilter_users SET email=REPLACE(email, '".$app->db->quote($this->oldDataRecord['domain'])."', '".$app->db->quote($this->dataRecord['domain'])."'), sys_userid = $client_user_id, sys_groupid = $sys_groupid WHERE email LIKE '%@".$app->db->quote($this->oldDataRecord['domain'])."'");
399402

400403
} // end if domain name changed
401404

0 commit comments

Comments
 (0)