mirror of
https://github.com/loewexy/pdnsmanager.git
synced 2025-01-16 03:02:22 +01:00
Fixed bug where remotes without records or domains were left in the db
This commit is contained in:
parent
15ff44a86e
commit
ee1b081447
2 changed files with 12 additions and 1 deletions
|
@ -191,7 +191,10 @@ class Domains
|
|||
throw new \Exceptions\NotFoundException();
|
||||
}
|
||||
|
||||
$query = $this->db->prepare('DELETE FROM domains WHERE id=:id');
|
||||
$query = $this->db->prepare('
|
||||
DELETE E FROM remote E
|
||||
LEFT OUTER JOIN records R ON R.id=E.record
|
||||
WHERE R.domain_id=:id');
|
||||
$query->bindValue(':id', $id, \PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
|
@ -199,6 +202,10 @@ class Domains
|
|||
$query->bindValue(':id', $id, \PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
$query = $this->db->prepare('DELETE FROM domains WHERE id=:id');
|
||||
$query->bindValue(':id', $id, \PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
$this->db->commit();
|
||||
}
|
||||
|
||||
|
|
|
@ -215,6 +215,10 @@ class Records
|
|||
throw new \Exceptions\NotFoundException();
|
||||
}
|
||||
|
||||
$query = $this->db->prepare('DELETE FROM remote WHERE record=:id');
|
||||
$query->bindValue(':id', $id, \PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
||||
$query = $this->db->prepare('DELETE FROM records WHERE id=:id');
|
||||
$query->bindValue(':id', $id, \PDO::PARAM_INT);
|
||||
$query->execute();
|
||||
|
|
Loading…
Reference in a new issue