v-delete-web-domain-proxy 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. domain_idn=$2
  13. restart=$3
  14. # Includes
  15. source $VESTA/func/main.sh
  16. source $VESTA/func/domain.sh
  17. source $VESTA/conf/vesta.conf
  18. # Additional argument formatting
  19. format_domain
  20. format_domain_idn
  21. # TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
  22. #----------------------------------------------------------#
  23. # Verifications #
  24. #----------------------------------------------------------#
  25. check_args '2' "$#" 'USER DOMAIN'
  26. is_format_valid 'user' 'domain'
  27. is_system_enabled "$PROXY_SYSTEM" 'WEB_SYSTEM'
  28. is_object_valid 'user' 'USER' "$user"
  29. is_object_unsuspended 'user' 'USER' "$user"
  30. is_object_valid 'web' 'DOMAIN' "$domain"
  31. is_object_unsuspended 'web' 'DOMAIN' "$domain"
  32. is_object_value_exist 'web' 'DOMAIN' "$domain" '$PROXY'
  33. #----------------------------------------------------------#
  34. # Action #
  35. #----------------------------------------------------------#
  36. # Defining domain parameters
  37. get_domain_values 'web'
  38. del_web_config "$PROXY_SYSTEM" "$PROXY.tpl"
  39. # Checking SSL
  40. if [ "$SSL" = 'yes' ]; then
  41. del_web_config "$PROXY_SYSTEM" "$PROXY.stpl"
  42. fi
  43. #----------------------------------------------------------#
  44. # Vesta #
  45. #----------------------------------------------------------#
  46. # Update config
  47. update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' ''
  48. update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' ''
  49. # Restart proxy server
  50. $BIN/v-restart-proxy $restart
  51. check_result $? "Proxy restart failed" >/dev/null
  52. # Logging
  53. log_history "disabled proxy support for $domain"
  54. log_event "$OK" "$ARGUMENTS"
  55. exit