nsDeleteZone: Fix zone deletion process
This commit is contained in:
parent
5af557f630
commit
81229a5e33
1 changed files with 4 additions and 8 deletions
12
fn/ns.php
12
fn/ns.php
|
@ -58,18 +58,14 @@ function nsCheckZonePossession($zone) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function nsDeleteZone($zone) {
|
function nsDeleteZone($zone) {
|
||||||
// Remove from Knot configuration
|
// Delete zone data
|
||||||
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
|
|
||||||
exec(CONF['dns']['knotc_path'] . ' --force zone-purge ' . $zone, result_code: $code);
|
exec(CONF['dns']['knotc_path'] . ' --force zone-purge ' . $zone, result_code: $code);
|
||||||
if ($code !== 0)
|
if ($code !== 0)
|
||||||
output(500, 'Failed to purge zone data.');
|
output(500, 'Failed to purge zone data.');
|
||||||
|
|
||||||
|
// Remove from Knot configuration
|
||||||
|
knotcConfExec(["unset 'zone[$zone]'"]);
|
||||||
|
|
||||||
// Remove from database
|
// Remove from database
|
||||||
query('delete', 'zones', [
|
query('delete', 'zones', [
|
||||||
'zone' => $zone,
|
'zone' => $zone,
|
||||||
|
|
Loading…
Reference in a new issue