v-delete-web-domain-proxy 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. # info: deleting web domain proxy configuration
  3. # options: USER DOMAIN [RESTART]
  4. # labels: web
  5. #
  6. # example: v-delete-web-domain-proxy alice lookinglass.com
  7. #
  8. # The function of deleting the virtualhost proxy configuration.
  9. #----------------------------------------------------------#
  10. # Variable&Function #
  11. #----------------------------------------------------------#
  12. # Argument definition
  13. user=$1
  14. domain=$2
  15. domain_idn=$2
  16. restart=$3
  17. # Includes
  18. source $HESTIA/func/main.sh
  19. source $HESTIA/func/domain.sh
  20. source $HESTIA/conf/hestia.conf
  21. # Additional argument formatting
  22. format_domain
  23. format_domain_idn
  24. # TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
  25. #----------------------------------------------------------#
  26. # Verifications #
  27. #----------------------------------------------------------#
  28. check_args '2' "$#" 'USER DOMAIN [RESTART]'
  29. is_format_valid 'user' 'domain'
  30. is_system_enabled "$PROXY_SYSTEM" 'WEB_SYSTEM'
  31. is_object_valid 'user' 'USER' "$user"
  32. is_object_unsuspended 'user' 'USER' "$user"
  33. is_object_valid 'web' 'DOMAIN' "$domain"
  34. is_object_unsuspended 'web' 'DOMAIN' "$domain"
  35. is_object_value_exist 'web' 'DOMAIN' "$domain" '$PROXY'
  36. # Perform verification if read-only mode is enabled
  37. check_hestia_demo_mode
  38. #----------------------------------------------------------#
  39. # Action #
  40. #----------------------------------------------------------#
  41. # Defining domain parameters
  42. get_domain_values 'web'
  43. del_web_config "$PROXY_SYSTEM" "$PROXY.tpl"
  44. # Checking SSL
  45. if [ "$SSL" = 'yes' ]; then
  46. del_web_config "$PROXY_SYSTEM" "$PROXY.stpl"
  47. fi
  48. #----------------------------------------------------------#
  49. # Hestia #
  50. #----------------------------------------------------------#
  51. # Update config
  52. update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' ''
  53. update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' ''
  54. # Restart proxy server
  55. $BIN/v-restart-proxy $restart
  56. check_result $? "Proxy restart failed" >/dev/null
  57. # Logging
  58. log_history "disabled proxy support for $domain"
  59. log_event "$OK" "$ARGUMENTS"
  60. exit