mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
web function refactoring
This commit is contained in:
parent
6168985b98
commit
8b237eb936
2 changed files with 33 additions and 12 deletions
|
@ -25,27 +25,48 @@ source $VESTA/conf/vesta.conf
|
|||
#----------------------------------------------------------#
|
||||
|
||||
check_args '2' "$#" 'USER DOMAIN'
|
||||
validate_format 'user' 'domain'
|
||||
is_format_valid 'user' 'domain'
|
||||
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'web' 'DOMAIN' "$domain"
|
||||
is_web_backend_pool_valid
|
||||
|
||||
# Checking last webdomain
|
||||
domains=$(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'|wc -l)
|
||||
if [ "$backend" = "$user" ] && [ "$domains" -gt 1 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Defining pool directory
|
||||
if [ -d "/etc/php-fpm.d" ]; then
|
||||
pool="/etc/php-fpm.d"
|
||||
fi
|
||||
if [ -d "/etc/php5/fpm/pool.d" ]; then
|
||||
pool="/etc/php5/fpm/pool.d"
|
||||
fi
|
||||
if [ ! -e "$pool" ]; then
|
||||
pool=$(find /etc/php* -type d \( -name "pool.d" -o -name "*fpm.d" \))
|
||||
if [ ! -e "$pool" ]; then
|
||||
check_result $E_NOTEXIST "php-fpm pool doesn't exist"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Defining backend type
|
||||
backend_type="$domain"
|
||||
if [ "$WEB_BACKEND_POOL" = 'user' ]; then
|
||||
backend_type="$user"
|
||||
fi
|
||||
|
||||
# Checking last webdomain
|
||||
if [ "$WEB_BACKEND_POOL" = 'user' ]; then
|
||||
domains=$(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'|wc -l)
|
||||
if [ "$backend" = "$user" ] && [ "$domains" -gt 1 ]; then
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# Deleting backend
|
||||
rm -f $pool/$backend.conf
|
||||
rm -f $pool/$backend_type.conf
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -60,6 +81,6 @@ fi
|
|||
|
||||
# Logging
|
||||
log_history "deleting backend support for $domain"
|
||||
log_event "$OK" "$EVENT"
|
||||
log_event "$OK" "$ARGUMENTS"
|
||||
|
||||
exit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue