v-delete-web-domain-proxy 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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=$(idn -t --quiet -u "$2" )
  12. domain_idn=$(idn -t --quiet -a "$domain")
  13. restart=$3
  14. # Includes
  15. source $VESTA/func/main.sh
  16. source $VESTA/func/domain.sh
  17. source $VESTA/conf/vesta.conf
  18. #----------------------------------------------------------#
  19. # Verifications #
  20. #----------------------------------------------------------#
  21. check_args '2' "$#" 'USER DOMAIN'
  22. is_format_valid 'user' 'domain'
  23. is_system_enabled "$PROXY_SYSTEM" 'WEB_SYSTEM'
  24. is_object_valid 'user' 'USER' "$user"
  25. is_object_unsuspended 'user' 'USER' "$user"
  26. is_object_valid 'web' 'DOMAIN' "$domain"
  27. is_object_unsuspended 'web' 'DOMAIN' "$domain"
  28. is_object_value_exist 'web' 'DOMAIN' "$domain" '$PROXY'
  29. #----------------------------------------------------------#
  30. # Action #
  31. #----------------------------------------------------------#
  32. # Defining domain parameters
  33. get_domain_values 'web'
  34. del_web_config "$PROXY_SYSTEM" "$PROXY.tpl"
  35. # Checking SSL
  36. if [ "$SSL" = 'yes' ]; then
  37. del_web_config "$PROXY_SYSTEM" "$PROXY.stpl"
  38. fi
  39. #----------------------------------------------------------#
  40. # Vesta #
  41. #----------------------------------------------------------#
  42. # Update config
  43. update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' ''
  44. update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' ''
  45. # Restart proxy server
  46. if [ "$restart" != 'no' ]; then
  47. $BIN/v-restart-proxy
  48. check_result $? "Proxy restart failed" >/dev/null
  49. fi
  50. # Logging
  51. log_history "disabled proxy support for $domain"
  52. log_event "$OK" "$ARGUMENTS"
  53. exit