From 81229a5e33a534bc97e583913f3a5456ff39fd41 Mon Sep 17 00:00:00 2001 From: Miraty Date: Thu, 27 Apr 2023 22:18:03 +0200 Subject: [PATCH] nsDeleteZone: Fix zone deletion process --- fn/ns.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fn/ns.php b/fn/ns.php index eeb7547..f521e7a 100644 --- a/fn/ns.php +++ b/fn/ns.php @@ -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,