nsDeleteZone: Fix zone deletion process

This commit is contained in:
Miraty 2023-04-27 22:18:03 +02:00
parent 5af557f630
commit 81229a5e33

View file

@ -58,18 +58,14 @@ function nsCheckZonePossession($zone) {
}
function nsDeleteZone($zone) {
// Remove from Knot configuration
knotcConfExec(["unset 'zone[$zone]'"]);
// Remove Knot zone file
if (unlink(CONF['ns']['knot_zones_path'] . '/' . $zone . 'zone') !== true)
output(500, 'Failed to remove Knot zone file.');
// Remove Knot related data
// Delete zone data
exec(CONF['dns']['knotc_path'] . ' --force zone-purge ' . $zone, result_code: $code);
if ($code !== 0)
output(500, 'Failed to purge zone data.');
// Remove from Knot configuration
knotcConfExec(["unset 'zone[$zone]'"]);
// Remove from database
query('delete', 'zones', [
'zone' => $zone,