Added web tab triggers. Issue #50

This commit is contained in:
Serghey Rodin 2012-02-20 13:47:30 +02:00
commit 3a09991f0a
8 changed files with 30 additions and 4 deletions

View file

@ -207,6 +207,7 @@ increase_ip_value "$ip"
# Increasing domain value
increase_user_value "$user" '$U_WEB_DOMAINS'
increase_user_value "$user" '$U_WEB_ALIASES'
# Defining domain variables
v_str="DOMAIN='$domain'"

View file

@ -120,6 +120,9 @@ fi
# Adding new alias
update_web_domain_value '$ALIAS' "$ALIAS"
# Update counters
increase_user_value "$user" '$U_WEB_ALIASES'
# Adding task to the vesta pipe
restart_schedule 'web'

View file

@ -63,6 +63,13 @@ conf="$V_HOME/$user/conf/web/httpd.conf"
# Deleting domain
del_web_config
# Checking aliases
if [ ! -z "$ALIAS" ]; then
aliases=$(echo $ALIAS | tr ',' '\n' | wc -l )
else
aliases=0
fi
# Checking ssl
if [ "$SSL" = 'yes' ]; then
tpl_file="$V_WEBTPL/apache_$TPL.stpl"
@ -152,6 +159,14 @@ decrease_ip_value "$IP"
# Decreasing domain value
decrease_user_value "$user" '$U_WEB_DOMAINS'
# Decreasing web aliases
decrease_user_value "$user" '$U_WEB_ALIASES' "$aliases"
# Decreasing web ssl
if [ "$SSL" = 'yes' ]; then
decrease_user_value "$user" '$U_WEB_SSL'
fi
# Adding task to the vesta pipe
restart_schedule 'web'

View file

@ -109,6 +109,9 @@ fi
# Deleting alias
update_web_domain_value '$ALIAS' "$ALIAS"
# Update counters
decrease_user_value "$user" '$U_WEB_ALIASES'
# Adding task to the vesta pipe
restart_schedule 'web'

View file

@ -48,7 +48,7 @@ fields="\$DOMAIN \$ALIAS"
case $format in
json) json_list ;;
plain) nohead=1; shell_list ;;
shell) shell_list | column -t ;;
shell) shell_list;;
*) check_args '1' '0' 'user [format]'
esac

View file

@ -97,6 +97,7 @@ fi
# Adding suspend in config
update_web_domain_value '$SUSPENDED' 'yes'
increase_user_value "$user" '$SUSPENDED_WEB'
# Adding task to the vesta pipe
restart_schedule 'web'

View file

@ -90,8 +90,9 @@ fi
# Vesta #
#----------------------------------------------------------#
# Adding suspend in config
# Updating suspend keys
update_web_domain_value '$SUSPENDED' 'no'
decrease_user_value "$user" '$SUSPENDED_WEB'
# Adding task to the vesta pipe
restart_schedule 'web'

View file

@ -692,6 +692,7 @@ update_user_value() {
increase_user_value() {
USER="$1"
key="${2//$}"
factor="${3-1}"
# Parsing current value
conf="$V_USERS/$USER/user.conf"
@ -701,7 +702,7 @@ increase_user_value() {
fi
# Increasing
new=$((old + 1 ))
new=$((old + factor))
sed -i "s/$key='$old'/$key='$new'/g" $conf
}
@ -731,6 +732,7 @@ is_type_valid() {
decrease_user_value() {
USER="$1"
key="${2//$}"
factor="${3-1}"
# Parsing current value
conf="$V_USERS/$USER/user.conf"
@ -743,7 +745,7 @@ decrease_user_value() {
if [ "$old" -le 1 ]; then
new=0
else
new=$((old - 1 ))
new=$((old - factor))
fi
sed -i "s/$key='$old'/$key='$new'/g" $conf
}