Fuller zone removal

This commit is contained in:
Miraty 2021-10-03 18:05:00 +02:00
parent 67abbabf9d
commit fdfec134b9

View file

@ -26,7 +26,6 @@ if (isset($_POST['domain']) AND isset($_SESSION['username'])) {
$knotZonePath = KNOT_ZONES_PATH . "/" . $_POST['domain'] . "zone";
$knotZone = file_get_contents(NIVER_TEMPLATE_PATH . "/knot.template");
$knotZone = preg_replace("/DOMAIN/", $_POST['domain'], $knotZone);
file_put_contents($knotZonePath, $knotZone);
chmod($knotZonePath, 0660);
@ -64,9 +63,18 @@ if (isset($_POST['zone']) AND isset($_SESSION['username'])) {
nsCheckZonePossession($_POST['zone']);
$knotZonePath = KNOT_ZONES_PATH . "/" . $_POST['zone'] . "zone";
unlink($knotZonePath);
// Remove Knot zone file
unlink(KNOT_ZONES_PATH . "/" . $_POST['zone'] . "zone");
// Remove Knot tied data
exec(KNOTC_PATH . " zone-purge" . $_POST['zone']);
// Remove from Knot configuration
exec(KNOTC_PATH . " conf-begin");
exec(KNOTC_PATH . " conf-unset 'zone[" . $_POST['domain'] . "]'");
exec(KNOTC_PATH . " conf-commit");
// Remove from Niver's database
$db = new PDO('sqlite:' . DB_PATH);
$stmt = $db->prepare("DELETE FROM zones WHERE zone = :zone AND username = :username");