@@ -38,7 +38,6 @@ is_object_valid 'user' 'USER' "$user"
3838is_object_unsuspended ' user' ' USER' " $user "
3939is_object_valid ' web' ' DOMAIN' " $domain "
4040is_object_unsuspended ' web' ' DOMAIN' " $domain "
41- is_object_value_exist ' web' ' DOMAIN' " $domain " ' $STATS'
4241
4342# Perform verification if read-only mode is enabled
4443check_hestia_demo_mode
@@ -48,50 +47,44 @@ check_hestia_demo_mode
4847# Action #
4948# ----------------------------------------------------------#
5049
51- # Defining statistic type
50+ # Parse aliases
5251get_domain_values ' web'
5352
54- # Comparing stats types
55- if [ " $STATS " == $type ]; then
56- log_event " $OK " " $ARGUMENTS "
57- exit 0
58- fi
59-
60- # Defining statistic dir
61- stats_dir=" $HOMEDIR /$user /web/$domain /stats"
62-
63- # Deleting dir content
64- rm -rf $stats_dir /*
65-
6653# Deleting config
67- rm -f $HOMEDIR /$user /conf/web/$domain /$STATS .conf
54+ rm -f $HOMEDIR /$user /conf/web/$domain /$type .conf
6855
6956# Adding statistic config
7057prepare_web_domain_values
58+
59+ if [ -z " ${aliases// ,/ } " ]; then
60+ stats_alias=" localhost"
61+ else
62+ stats_alias=${aliases_idn// ,/ }
63+ fi
64+
7165cat $WEBTPL /$type /$type .tpl | \
72- sed -e " s/ %ip%/ $ip / g" \
73- -e " s/ %web_port%/ $WEB_PORT / g" \
74- -e " s/ %web_system%/ $WEB_SYSTEM / g" \
75- -e " s/ %web_ssl_port%/ $WEB_SSL_PORT / g" \
76- -e " s/ %rgroups%/ $WEB_RGROUPS / g" \
77- -e " s/ %proxy_system%/ $PROXY_SYSTEM / g" \
78- -e " s/ %proxy_port%/ $PROXY_PORT / g" \
79- -e " s/ %proxy_ssl_port%/ $PROXY_SSL_PORT / g" \
80- -e " s/ %domain_idn%/ $domain_idn / g" \
81- -e " s/ %domain%/ $domain / g" \
82- -e " s/ %user%/ $user / g" \
83- -e " s/ %home%/ ${ HOMEDIR//// \/ } / g" \
84- -e " s/ %alias%/ ${aliases// ,/ } / g" \
85- -e " s/ %alias_idn%/ ${aliases_idn // , / } / g" \
86- > $HOMEDIR /$user /conf/web/$type . $ domain .conf
66+ sed -e " s| %ip%| $ip | g" \
67+ -e " s| %web_port%| $WEB_PORT | g" \
68+ -e " s| %web_system%| $WEB_SYSTEM | g" \
69+ -e " s| %web_ssl_port%| $WEB_SSL_PORT | g" \
70+ -e " s| %rgroups%| $WEB_RGROUPs | g" \
71+ -e " s| %proxy_system%| $PROXY_SYSTEM | g" \
72+ -e " s| %proxy_port%| $PROXY_PORT | g" \
73+ -e " s| %proxy_ssl_port%| $PROXY_SSL_PORT | g" \
74+ -e " s| %domain_idn%| $domain_idn | g" \
75+ -e " s| %domain%| $domain | g" \
76+ -e " s| %user%| $user | g" \
77+ -e " s| %home%| $ HOMEDIR| g" \
78+ -e " s| %alias%| ${aliases// ,/ } | g" \
79+ -e " s| %alias_idn%| $stats_alias | g" \
80+ > $HOMEDIR /$user /conf/web/$domain / $type .conf
8781
8882if [ " $type " == ' awstats' ]; then
8983 rm -f /etc/awstats/$type .$domain_idn .conf
90- ln -s $HOMEDIR /$user /conf/web/$type . $ domain .conf \
84+ ln -s $HOMEDIR /$user /conf/web/$domain / $type .conf \
9185 /etc/awstats/$type .$domain_idn .conf
9286fi
9387
94-
9588# ----------------------------------------------------------#
9689# Hestia #
9790# ----------------------------------------------------------#
0 commit comments