Skip to content
Snippets Groups Projects
Commit 0614b51e authored by Carsten's avatar Carsten
Browse files

fix duplicate entry caused in rr_insert

parent bbc4ad95
No related branches found
No related tags found
2 merge requests!88Fix Update errors,!46Master
...@@ -165,7 +165,7 @@ class powerdns_plugin { ...@@ -165,7 +165,7 @@ class powerdns_plugin {
$this->soa_delete($event_name, $data); $this->soa_delete($event_name, $data);
} else { } else {
$exists = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["id"]); $exists = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["id"]);
if($data["old"]["active"] == 'Y' && $exists){ if($data["old"]["active"] == 'Y' && is_array($exists)){
$origin = substr($data["new"]["origin"], 0, -1); $origin = substr($data["new"]["origin"], 0, -1);
$ispconfig_id = $data["new"]["id"]; $ispconfig_id = $data["new"]["id"];
...@@ -273,6 +273,8 @@ class powerdns_plugin { ...@@ -273,6 +273,8 @@ class powerdns_plugin {
function rr_insert($event_name, $data) { function rr_insert($event_name, $data) {
global $app, $conf; global $app, $conf;
if($data["new"]["active"] != 'Y') return; if($data["new"]["active"] != 'Y') return;
$exists = $app->db->queryOneRecord("SELECT * FROM powerdns.records WHERE ispconfig_id = ".$data["new"]["id"]);
if ( is_array($exists) ) return;
$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]); $zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
$origin = substr($zone["origin"], 0, -1); $origin = substr($zone["origin"], 0, -1);
...@@ -339,7 +341,7 @@ class powerdns_plugin { ...@@ -339,7 +341,7 @@ class powerdns_plugin {
$this->rr_delete($event_name, $data); $this->rr_delete($event_name, $data);
} else { } else {
$exists = $app->db->queryOneRecord("SELECT * FROM powerdns.records WHERE ispconfig_id = ".$data["new"]["id"]); $exists = $app->db->queryOneRecord("SELECT * FROM powerdns.records WHERE ispconfig_id = ".$data["new"]["id"]);
if($data["old"]["active"] == 'Y' && $exists){ if($data["old"]["active"] == 'Y' && is_array($exists)){
$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]); $zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
$origin = substr($zone["origin"], 0, -1); $origin = substr($zone["origin"], 0, -1);
$powerdns_zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["zone"]." AND type = 'MASTER'"); $powerdns_zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["zone"]." AND type = 'MASTER'");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment