Skip to content

Commit a4386b2

Browse files
author
Kristan Kenney
committed
Update domain handling routines
1 parent 9a140b0 commit a4386b2

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

func/domain.sh

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -307,34 +307,32 @@ del_web_config() {
307307
fi
308308

309309
# Remove domain configuration files and clean up symbolic links
310-
rm -f /etc/$WEB_SYSTEM/conf.d/domains/$domain.conf
311-
rm -f /etc/$WEB_SYSTEM/conf.d/domains/$domain.ssl.conf
310+
if [ ! -z "$WEB_SYSTEM" ]; then
311+
rm -f /etc/$WEB_SYSTEM/conf.d/domains/$domain.conf
312+
rm -f /etc/$WEB_SYSTEM/conf.d/domains/$domain.ssl.conf
313+
fi
312314
if [ ! -z "$PROXY_SYSTEM" ]; then
313315
rm -f /etc/$PROXY_SYSTEM/conf.d/domains/$domain.conf
314316
rm -f /etc/$PROXY_SYSTEM/conf.d/domains/$domain.ssl.conf
315317
fi
316318

317319
# Clean up legacy configuration files
318-
if [ -e "$conf" ]; then
319-
if [[ "$2" =~ stpl$ ]]; then
320-
rm -f /etc/$WEB_SYSTEM/conf.d/domains/$domain.ssl.conf
321-
else
322-
rm -f /etc/$WEB_SYSTEM/conf.d/domains/$domain.conf
323-
fi
324-
rm -f $conf
325-
else
326-
# fallback to old style configs
320+
if [ ! -e "$conf" ]; then
327321
conf="$HOMEDIR/$user/conf/web/$1.conf"
328322
if [[ "$2" =~ stpl$ ]]; then
329323
conf="$HOMEDIR/$user/conf/web/s$1.conf"
330324
fi
331325
get_web_config_lines $WEBTPL/$1/$WEB_BACKEND/$2 $conf
332326
sed -i "$top_line,$bottom_line d" $conf
327+
328+
# Remove old global includes file
329+
rm -f /etc/$1/conf.d/hestia.conf
333330
fi
334-
# clean-up for both config styles if there is no more domains
331+
332+
# Clean up user web.conf file if no more domains exist
335333
web_domain=$(grep DOMAIN $USER_DATA/web.conf |wc -l)
336334
if [ "$web_domain" -eq '0' ]; then
337-
sed -i "/.*\/$user\/conf\/web\//d" /etc/$1/conf.d/hestia.conf
335+
sed -i "/.*\/$user\/conf\/web\//d"
338336
if [ -f "$conf" ]; then
339337
rm -f $conf
340338
fi

func/rebuild.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ rebuild_web_domain_conf() {
160160
prepare_web_domain_values
161161

162162
# Remove old web configuration files
163-
if [ -f /etc/$PROXY_SYSTEM/conf.d/$domain.conf ]; then
164-
rm -f /etc/$PROXY_SYSTEM/conf.d/$domain*.conf
165-
fi
166163
if [ -f /etc/$WEB_SYSTEM/conf.d/$domain.conf ]; then
167164
rm -f /etc/$WEB_SYSTEM/conf.d/$domain*.conf
168165
fi
166+
if [ -f /etc/$PROXY_SYSTEM/conf.d/$domain.conf ]; then
167+
rm -f /etc/$PROXY_SYSTEM/conf.d/$domain*.conf
168+
fi
169169

170170
# Rebuilding domain directories
171171
mkdir -p $HOMEDIR/$user/web/$domain \

0 commit comments

Comments
 (0)