v-delete-web-domain-proxy 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. # info: deleting web domain proxy configuration
  3. # options: USER DOMAIN
  4. #
  5. # The function of deleting the virtualhost proxy configuration.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. user=$1
  11. domain=$2
  12. restart=$3
  13. # Includes
  14. source $VESTA/func/main.sh
  15. source $VESTA/func/domain.sh
  16. source $VESTA/conf/vesta.conf
  17. # Additional argument formatting
  18. format_domain
  19. format_domain_idn
  20. #----------------------------------------------------------#
  21. # Verifications #
  22. #----------------------------------------------------------#
  23. check_args '2' "$#" 'USER DOMAIN'
  24. is_format_valid 'user' 'domain'
  25. is_system_enabled "$PROXY_SYSTEM" 'WEB_SYSTEM'
  26. is_object_valid 'user' 'USER' "$user"
  27. is_object_unsuspended 'user' 'USER' "$user"
  28. is_object_valid 'web' 'DOMAIN' "$domain"
  29. is_object_unsuspended 'web' 'DOMAIN' "$domain"
  30. is_object_value_exist 'web' 'DOMAIN' "$domain" '$PROXY'
  31. #----------------------------------------------------------#
  32. # Action #
  33. #----------------------------------------------------------#
  34. # Defining domain parameters
  35. get_domain_values 'web'
  36. del_web_config "$PROXY_SYSTEM" "$PROXY.tpl"
  37. # Checking SSL
  38. if [ "$SSL" = 'yes' ]; then
  39. del_web_config "$PROXY_SYSTEM" "$PROXY.stpl"
  40. fi
  41. #----------------------------------------------------------#
  42. # Vesta #
  43. #----------------------------------------------------------#
  44. # Update config
  45. update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' ''
  46. update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' ''
  47. # Restart proxy server
  48. $BIN/v-restart-proxy $restart
  49. check_result $? "Proxy restart failed" >/dev/null
  50. # Logging
  51. log_history "disabled proxy support for $domain"
  52. log_event "$OK" "$ARGUMENTS"
  53. exit