Skip to content

Commit 5619c7d

Browse files
committed
Fixed: FS#1229 - ISPConfig3 creates the desired e-mail domain twice (on master server AND on the selected Slave)
1 parent efbdeae commit 5619c7d

10 files changed

+18
-9
lines changed

install/tpl/mysql-virtual_domains.cf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ dbname = {mysql_server_database}
44
table = mail_domain
55
select_field = domain
66
where_field = domain
7-
additional_conditions = and active = 'y'
7+
additional_conditions = and active = 'y' and server_id = {server_id}
88
hosts = {mysql_server_ip}

install/tpl/mysql-virtual_email2email.cf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ dbname = {mysql_server_database}
44
table = mail_user
55
select_field = email
66
where_field = email
7-
additional_conditions = and postfix = 'y'
7+
additional_conditions = and postfix = 'y' and server_id = {server_id}
88
hosts = {mysql_server_ip}

install/tpl/mysql-virtual_forwardings.cf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ dbname = {mysql_server_database}
44
table = mail_forwarding
55
select_field = destination
66
where_field = source
7-
additional_conditions = and active = 'y'
7+
additional_conditions = and active = 'y' and server_id = {server_id}
88
hosts = {mysql_server_ip}

install/tpl/mysql-virtual_mailboxes.cf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ dbname = {mysql_server_database}
44
table = mail_user
55
select_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
66
where_field = email
7-
additional_conditions = and postfix = 'y'
7+
additional_conditions = and postfix = 'y' and server_id = {server_id}
88
hosts = {mysql_server_ip}

install/tpl/mysql-virtual_recipient.cf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ dbname = {mysql_server_database}
44
table = mail_access
55
select_field = access
66
where_field = source
7-
additional_conditions = and type = 'recipient' and active = 'y'
7+
additional_conditions = and type = 'recipient' and active = 'y' and server_id = {server_id}
88
hosts = {mysql_server_ip}

install/tpl/mysql-virtual_relaydomains.cf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ dbname = {mysql_server_database}
44
table = mail_transport
55
select_field = domain
66
where_field = domain
7-
additional_conditions = and active = 'y'
7+
additional_conditions = and active = 'y' and server_id = {server_id}
88
hosts = {mysql_server_ip}

install/tpl/mysql-virtual_relayrecipientmaps.cf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ dbname = {mysql_server_database}
44
table = mail_relay_recipient
55
select_field = access
66
where_field = source
7-
additional_conditions = and active = 'y'
7+
additional_conditions = and active = 'y' and server_id = {server_id}
88
hosts = {mysql_server_ip}

install/tpl/mysql-virtual_sender.cf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ dbname = {mysql_server_database}
44
table = mail_access
55
select_field = access
66
where_field = source
7-
additional_conditions = and type = 'sender' and active = 'y'
7+
additional_conditions = and type = 'sender' and active = 'y' and server_id = {server_id}
88
hosts = {mysql_server_ip}

install/tpl/mysql-virtual_transports.cf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ dbname = {mysql_server_database}
44
table = mail_transport
55
select_field = transport
66
where_field = domain
7-
additional_conditions = and active = 'y'
7+
additional_conditions = and active = 'y' and server_id = {server_id}
88
hosts = {mysql_server_ip}

server/lib/classes/modules.inc.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@ function processDatalog() {
109109

110110
$this->current_datalog_id = $d["datalog_id"];
111111

112+
/*
113+
* If we are in a mirror setup, rewrite the server_id of records that originally
114+
* belonged to the mirrored server to the local server_id
115+
*/
116+
if($conf["mirror_server_id"] > 0 && $d['dbtable'] != 'server') {
117+
if(isset($data['new']['server_id']) && $data['new']['server_id'] == $conf["mirror_server_id"]) $data['new']['server_id'] = $conf["server_id"];
118+
if(isset($data['old']['server_id']) && $data['old']['server_id'] == $conf["mirror_server_id"]) $data['old']['server_id'] = $conf["server_id"];
119+
}
120+
112121
if(count($data['new']) > 0) {
113122
if($d["action"] == 'i' || $d["action"] == 'u') {
114123
$idx = explode(":",$d["dbidx"]);

0 commit comments

Comments
 (0)