Fixed bug where serial was never incremented

This commit is contained in:
Lukas Metzger 2018-04-12 09:22:32 +02:00
parent a0548c0e01
commit 5d2ef81610

View file

@ -188,6 +188,9 @@ class Records
$record['ttl'] = intval($record['ttl']);
$record['domain'] = intval($record['domain']);
$soa = new \Operations\Soa($this->c);
$soa->updateSerial($domain);
$this->db->commit();
return $record;
@ -206,15 +209,19 @@ class Records
{
$this->db->beginTransaction();
$query = $this->db->prepare('SELECT id FROM records WHERE id=:id');
$query = $this->db->prepare('SELECT id,domain_id FROM records WHERE id=:id');
$query->bindValue(':id', $id, \PDO::PARAM_INT);
$query->execute();
if ($query->fetch() === false) { //Domain does not exist
$record = $query->fetch();
if ($record === false) { //Domain does not exist
$this->db->rollBack();
throw new \Exceptions\NotFoundException();
}
$domainId = intval($record['domain_id']);
$query = $this->db->prepare('DELETE FROM remote WHERE record=:id');
$query->bindValue(':id', $id, \PDO::PARAM_INT);
$query->execute();
@ -223,6 +230,9 @@ class Records
$query->bindValue(':id', $id, \PDO::PARAM_INT);
$query->execute();
$soa = new \Operations\Soa($this->c);
$soa->updateSerial($domainId);
$this->db->commit();
}
@ -276,7 +286,7 @@ class Records
{
$this->db->beginTransaction();
$query = $this->db->prepare('SELECT id,name,type,content,prio,ttl FROM records WHERE id=:recordId');
$query = $this->db->prepare('SELECT id,domain_id,name,type,content,prio,ttl FROM records WHERE id=:recordId');
$query->bindValue(':recordId', $recordId);
$query->execute();
@ -291,6 +301,8 @@ class Records
throw new \Exceptions\SemanticException();
}
$domainId = intval($record['domain_id']);
$name = $name === null ? $record['name'] : $name;
$type = $type === null ? $record['type'] : $type;
$content = $content === null ? $record['content'] : $content;
@ -306,6 +318,9 @@ class Records
$query->bindValue(':ttl', $ttl);
$query->execute();
$soa = new \Operations\Soa($this->c);
$soa->updateSerial($domainId);
$this->db->commit();
}
}