From 0df5269cc6432cf5eb1a47e846912e70a2949605 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Sun, 27 Jul 2014 10:15:20 -0400
Subject: [PATCH] Fixed: FS#3499 - fetchmail to address not updated after domainname change
---
interface/web/mail/mail_domain_edit.php | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php
index 45a1ade..02dc55b 100644
--- a/interface/web/mail/mail_domain_edit.php
+++ b/interface/web/mail/mail_domain_edit.php
@@ -359,7 +359,16 @@
//* Update the mailinglist
$app->db->query("UPDATE mail_mailinglist SET sys_userid = $client_user_id, sys_groupid = $sys_groupid WHERE domain = '".$app->db->quote($this->oldDataRecord['domain'])."'");
-
+
+ //* Update fetchmail accounts
+ $fetchmail = $app->db->queryAllRecords("SELECT * FROM mail_get WHERE destination like '%@".$app->db->quote($this->oldDataRecord['domain'])."'");
+ if(is_array($fetchmail)) {
+ foreach($fetchmail as $rec) {
+ $destination = $app->db->quote(str_replace($this->oldDataRecord['domain'], $this->dataRecord['domain'], $rec['destination']));
+ $app->db->datalogUpdate('mail_get', "destination = '$destination', sys_userid = $client_user_id, sys_groupid = '$sys_groupid'", 'mailget_id', $rec['mailget_id']);
+ }
+ }
+
//* Delete the old spamfilter record
$tmp = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($this->oldDataRecord["domain"])."'");
$app->db->datalogDelete('spamfilter_users', 'id', $tmp["id"]);
--
Gitblit v1.9.1