web function refactoring

This commit is contained in:
Serghey Rodin 2016-06-09 17:05:41 +03:00
commit 872cd3ac45
20 changed files with 744 additions and 1239 deletions

View file

@ -27,7 +27,7 @@ source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
check_args '3' "$#" 'USER DOMAIN TYPE'
validate_format 'user' 'domain'
is_format_valid 'user' 'domain'
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
is_type_valid "$STATS_SYSTEM" "$type"
is_object_valid 'user' 'USER' "$user"
@ -46,7 +46,7 @@ get_domain_values 'web'
# Comparing stats types
if [ "$STATS" == $type ]; then
log_event "$OK" "$EVENT"
log_event "$OK" "$ARGUMENTS"
exit 0
fi
@ -59,10 +59,8 @@ rm -rf $stats_dir/*
# Deleting config
rm -f $HOMEDIR/$user/conf/web/$STATS.$domain.conf
# Preparing domain values for the template substitution
upd_web_domain_values
# Adding statistic config
prepare_web_domain_values
cat $WEBTPL/$type/$type.tpl |\
sed -e "s/%ip%/$ip/g" \
-e "s/%web_port%/$WEB_PORT/g" \
@ -98,7 +96,7 @@ update_object_value 'web' 'DOMAIN' "$domain" '$STATS' "$type"
# Logging
log_history "changed web log stats for $domain to $type"
log_event "$OK" "$EVENT"
log_event "$OK" "$ARGUMENTS"
# Build stats
exec $BIN/v-update-web-domain-stat $user $domain