@@ -22,7 +22,7 @@ domain_idn=$(idn -t --quiet -a "$domain")
2222ip=$3
2323template=${4-default}
2424
25- # Importing variables
25+ # Includes
2626source $VESTA /conf/vesta.conf
2727source $VESTA /func/shared.sh
2828source $VESTA /func/domain.sh
@@ -33,32 +33,15 @@ source $VESTA/func/ip.sh
3333# Verifications #
3434# ----------------------------------------------------------#
3535
36- # Checking arg number
3736check_args ' 3' " $# " ' user domain ip [template]'
38-
39- # Checking argument format
4037validate_format ' user' ' domain' ' ip' ' template'
41-
42- # Checking web system is enabled
43- is_system_enabled ' WEB_SYSTEM'
44-
45- # Checking user
38+ is_system_enabled " $WEB_SYSTEM "
4639is_object_valid ' user' ' USER' " $user "
47-
48- # Checking user is active
4940is_object_unsuspended ' user' ' USER' " $user "
50-
51- # Checking domain
52- is_domain_new ' dns'
53-
54- # Checking ip
41+ is_domain_new ' web'
42+ is_ip_valid
5543is_ip_avalable
56-
57- # Checking package
5844is_package_full ' WEB_DOMAINS'
59-
60- # Checking template
61- templates=$( get_user_value ' $WEB_TPL' )
6245is_apache_template_valid
6346
6447
@@ -89,7 +72,6 @@ group="$user"
8972email=" $user @$domain "
9073docroot=" $HOMEDIR /$user /web/$domain /public_html"
9174docroot_string=" DocumentRoot $docroot "
92-
9375conf=" $HOMEDIR /$user /conf/web/httpd.conf"
9476tpl_file=" $WEBTPL /apache_$template .tpl"
9577
192174# Vesta #
193175# ----------------------------------------------------------#
194176
195- # Increasing ip value
177+ # Increasing counters
196178increase_ip_value " $ip "
197-
198- # Increasing domain value
199179increase_user_value " $user " ' $U_WEB_DOMAINS'
200180increase_user_value " $user " ' $U_WEB_ALIASES'
201181
202182# Defining domain variables
203- v_str=" DOMAIN='$domain '"
204- v_str=" $v_str IP='$ip ' IP6=''"
205- v_str=" $v_str U_DISK='0'"
206- v_str=" $v_str U_BANDWIDTH='0'"
207- v_str=" $v_str TPL='$template '"
208- v_str=" $v_str ALIAS='$aliases '"
209- v_str=" $v_str $template_data " # Inserting PHP, CGI and ELOG keys
210- v_str=" $v_str STATS='' STATS_AUTH=''"
211- v_str=" $v_str SSL='no' SSL_HOME='single'"
212- v_str=" $v_str NGINX='' NGINX_EXT='' SUSPENDED='no' DATE='$DATE '"
183+ str=" DOMAIN='$domain ' IP='$ip ' IP6='' ALIAS='$aliases ' TPL='$template '"
184+ str=" $str $template_data SSL='no' SSL_HOME='single' NGINX='' NGINX_EXT=''"
185+ str=" $str STATS='' STATS_USER='' U_DISK='0' U_BANDWIDTH='0' SUSPENDED='no'"
186+ str=" $str TIME='$TIME ' DATE='$DATE '"
213187
214188# Registering domain
215- echo " $v_str " >> $USER_DATA /web.conf
189+ echo " $str " >> $USER_DATA /web.conf
216190chmod 660 $USER_DATA /web.conf
217191
218- # Adding task to the vesta pipe
219- $BIN /v_restart_web
192+ # Restart web server
193+ $BIN /v_restart_web " $EVENT "
220194
221195# Logging
222- log_history " $EVENT " " v_delete_web_domain $user $domain "
196+ log_history " $EVENT "
223197log_event " $OK " " $EVENT "
224198
225199exit
0 commit comments