From 57b0402875ac23535ce6f7ff85ca6fbf5ebffe19 Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Mon, 14 Aug 2017 10:09:14 +0200 Subject: [PATCH] DON'T delete vhost file when deleting a non-vhost-based domaine-type sub_domain. fixes #138 --- src/functions_hosting.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/functions_hosting.sh b/src/functions_hosting.sh index b97077d5..ff38a62c 100644 --- a/src/functions_hosting.sh +++ b/src/functions_hosting.sh @@ -209,10 +209,14 @@ host_delete() { return $? fi - local FENABLED=$(host_conffile "$FQDN") - local FDISABLED="$FENABLED-disabled" - - [ -w "$FENABLED" ] && rm -f "$FENABLED" - [ -w "$FDISABLED" ] && rm -f "$FDISABLED" + # Fix of a longstanding BUG: we only DELETE the vhost file if the type is a vhost one ! + if [ -f "/etc/alternc/templates/${VTYPE}.conf" ] + then + local FENABLED=$(host_conffile "$FQDN") + local FDISABLED="$FENABLED-disabled" + + [ -w "$FENABLED" ] && rm -f "$FENABLED" + [ -w "$FDISABLED" ] && rm -f "$FDISABLED" + fi }