55# Web template check
66is_web_template_valid () {
77 if [ ! -z " $WEB_SYSTEM " ]; then
8- template=$1
9- if [ -z " $template " ]; then
10- template=$( grep WEB_TEMPLATE $USER_DATA /user.conf | cut -f2 -d \' )
11- if [ -z " $template " ]; then
12- template=" default"
13- fi
14- fi
15- tpl=" $WEBTPL /$WEB_SYSTEM /$WEB_BACKEND /$template .tpl"
16- stpl=" $WEBTPL /$WEB_SYSTEM /$WEB_BACKEND /$template .stpl"
8+ tpl=" $WEBTPL /$WEB_SYSTEM /$WEB_BACKEND /$1 .tpl"
9+ stpl=" $WEBTPL /$WEB_SYSTEM /$WEB_BACKEND /$1 .stpl"
1710 if [ ! -e " $tpl " ] || [ ! -e " $stpl " ]; then
18- check_result $E_NOTEXIST " $template web template doesn't exist"
11+ check_result $E_NOTEXIST " $1 web template doesn't exist"
1912 fi
2013 fi
2114}
2215
2316# Proxy template check
2417is_proxy_template_valid () {
2518 if [ ! -z " $PROXY_SYSTEM " ]; then
26- proxy=$1
27- if [ -z " $proxy " ]; then
28- proxy=$( grep PROXY_TEMPLATE $USER_DATA /user.conf | cut -f2 -d \' )
29- if [ -z " $proxy " ]; then
30- proxy=" default"
31- fi
32- fi
33- tpl=" $WEBTPL /$PROXY_SYSTEM /$proxy .tpl"
34- stpl=" $WEBTPL /$PROXY_SYSTEM /$proxy .stpl"
19+ tpl=" $WEBTPL /$PROXY_SYSTEM /$1 .tpl"
20+ stpl=" $WEBTPL /$PROXY_SYSTEM /$1 .stpl"
3521 if [ ! -e " $tpl " ] || [ ! -e " $stpl " ]; then
36- check_result $E_NOTEXIST " $proxy proxy template doesn't exist"
22+ check_result $E_NOTEXIST " $1 proxy template doesn't exist"
3723 fi
3824 fi
3925}
4026
4127# Backend template check
4228is_backend_template_valid () {
43- if [ ! -e " $WEBTPL /$WEB_BACKEND /$1 .tpl" ]; then
44- check_result $E_NOTEXIST " $backend backend template doesn't exist"
29+ if [ ! -z " $WEB_BACKEND " ]; then
30+ if [ ! -e " $WEBTPL /$WEB_BACKEND /$1 .tpl" ]; then
31+ check_result $E_NOTEXIST " $1 backend template doesn't exist"
32+ fi
4533 fi
4634}
4735
@@ -210,7 +198,7 @@ add_web_config() {
210198 -e " s|%proxy_ssl_port%|$PROXY_SSL_PORT |g" \
211199 -e " s/%proxy_extentions%/${PROXY_EXT// ,/ |} /g" \
212200 -e " s|%user%|$user |g" \
213- -e " s|%group%|$group |g" \
201+ -e " s|%group%|$user |g" \
214202 -e " s|%home%|$HOMEDIR |g" \
215203 -e " s|%docroot%|$HOMEDIR /$user /web/$domain /public_html|g" \
216204 -e " s|%sdocroot%|$HOMEDIR /$user /web/$domain /public_html|g" \
@@ -225,7 +213,7 @@ add_web_config() {
225213 chmod 640 $conf
226214
227215 if [ -z " $( grep " $conf " /etc/$1 /conf.d/vesta.conf) " ]; then
228- if [ " $WEB_SYSTEM " != ' nginx' ]; then
216+ if [ " $1 " != ' nginx' ]; then
229217 echo " Include $conf " >> /etc/$1 /conf.d/vesta.conf
230218 else
231219 echo " include $conf ;" >> /etc/$1 /conf.d/vesta.conf
@@ -265,6 +253,10 @@ get_web_config_lines() {
265253
266254# Replace web config
267255replace_web_config () {
256+ conf=" $HOMEDIR /$user /conf/web/$1 .conf"
257+ if [[ " $2 " =~ stpl$ ]]; then
258+ conf=" $HOMEDIR /$user /conf/web/s$1 .conf"
259+ fi
268260 get_web_config_lines $WEBTPL /$1 /$WEB_BACKEND /$2 $conf
269261 sed -i " $top_line ,$bottom_line s|$old |$new |g" $conf
270262}
@@ -355,9 +347,8 @@ is_web_domain_cert_valid() {
355347
356348# DNS template check
357349is_dns_template_valid () {
358- t=" $DNSTPL /$template .tpl"
359- if [ ! -e $t ]; then
360- check_result $E_NOTEXIST " dns template $template doesn't exist"
350+ if [ ! -e " $DNSTPL /$1 .tpl" ]; then
351+ check_result $E_NOTEXIST " $1 dns template doesn't exist"
361352 fi
362353}
363354
0 commit comments