1
0
mirror of https://github.com/myvesta/vesta.git synced 2025-03-11 03:52:44 -07:00
myvesta/bin/v-delete-web-domain-proxy

74 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

2013-01-19 23:07:26 +02:00
#!/bin/bash
2013-05-10 11:04:40 +03:00
# info: deleting web domain proxy configuration
2013-01-19 23:07:26 +02:00
# options: USER DOMAIN
#
2013-05-10 11:04:40 +03:00
# The function of deleting the virtualhost proxy configuration.
2013-01-19 23:07:26 +02:00
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
2015-11-06 17:38:58 +02:00
# Argument definition
2013-01-19 23:07:26 +02:00
user=$1
domain=$2
2017-03-05 23:34:07 +01:00
domain_idn=$2
2013-01-19 23:07:26 +02:00
restart=$3
# Includes
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
source $VESTA/conf/vesta.conf
2013-01-19 23:07:26 +02:00
# Additional argument formatting
format_domain
format_domain_idn
2017-03-05 23:34:07 +01:00
# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
2013-01-19 23:07:26 +02:00
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'USER DOMAIN'
2016-06-09 17:05:41 +03:00
is_format_valid 'user' 'domain'
is_system_enabled "$PROXY_SYSTEM" 'WEB_SYSTEM'
2013-01-19 23:07:26 +02:00
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain"
2013-05-10 11:04:40 +03:00
is_object_value_exist 'web' 'DOMAIN' "$domain" '$PROXY'
2013-01-19 23:07:26 +02:00
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining domain parameters
get_domain_values 'web'
2016-06-09 17:05:41 +03:00
del_web_config "$PROXY_SYSTEM" "$PROXY.tpl"
2013-01-19 23:07:26 +02:00
2013-05-10 11:04:40 +03:00
# Checking SSL
2013-01-19 23:07:26 +02:00
if [ "$SSL" = 'yes' ]; then
2016-06-09 17:05:41 +03:00
del_web_config "$PROXY_SYSTEM" "$PROXY.stpl"
2013-01-19 23:07:26 +02:00
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Update config
2013-05-10 11:04:40 +03:00
update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' ''
update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' ''
# Restart proxy server
$BIN/v-restart-proxy $restart
check_result $? "Proxy restart failed" >/dev/null
2013-01-19 23:07:26 +02:00
# Logging
2013-05-10 11:04:40 +03:00
log_history "disabled proxy support for $domain"
2016-06-09 17:05:41 +03:00
log_event "$OK" "$ARGUMENTS"
2013-01-19 23:07:26 +02:00
exit