v_del_web_domain_cgi 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/bin/bash
  2. # info: deliting cgi for domain
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user="$1"
  8. domain=$(idn -t --quiet -u "$2" )
  9. domain_idn=$(idn -t --quiet -a "$domain")
  10. # Importing variables
  11. source $VESTA/conf/vars.conf
  12. source $V_FUNC/shared_func.sh
  13. source $V_FUNC/domain_func.sh
  14. #----------------------------------------------------------#
  15. # Verifications #
  16. #----------------------------------------------------------#
  17. # Checking arg number
  18. check_args '2' "$#" 'user domain'
  19. # Checking argument format
  20. format_validation 'user' 'domain'
  21. # Checking web system is enabled
  22. is_system_enabled 'web'
  23. # Checking user
  24. is_user_valid
  25. # Checking user is active
  26. is_user_suspended
  27. # Checking domain exist
  28. is_web_domain_valid
  29. # Checking domain is not suspened
  30. is_domain_suspended 'web'
  31. # Checking cgi is added
  32. is_web_domain_value_exist '$CGI'
  33. #----------------------------------------------------------#
  34. # Action #
  35. #----------------------------------------------------------#
  36. # Get template name
  37. tpl_name=$(get_web_domain_value '$TPL')
  38. tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
  39. # Defining params for ScriptAlias
  40. conf="$V_HOME/$user/conf/httpd.conf"
  41. search_phrase='ScriptAlias '
  42. str_repl=" #ScriptAlias /cgi-bin/ $V_HOME/$user/web/$domain/cgi-bin"
  43. change_web_config
  44. # Defining params for Options
  45. search_phrase='Options '
  46. str_repl=' Options +Includes -Indexes -ExecCGI'
  47. change_web_config
  48. # Checking ssl
  49. cert=$(get_web_domain_value '$SSL_CERT')
  50. if [ ! -z "$cert" ]; then
  51. # Defining params for ScriptAlias
  52. tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
  53. conf="$V_HOME/$user/conf/shttpd.conf"
  54. search_phrase='ScriptAlias '
  55. str_repl=" #ScriptAlias /cgi-bin/ $V_HOME/$user/web/$domain/cgi-bin"
  56. change_web_config
  57. # Defining params for Options
  58. search_phrase='Options '
  59. str_repl=' Options +Includes -Indexes -ExecCGI'
  60. change_web_config
  61. fi
  62. #----------------------------------------------------------#
  63. # Vesta #
  64. #----------------------------------------------------------#
  65. # Deleting cgi in config
  66. update_web_domain_value '$CGI' 'no'
  67. # Adding task to the vesta pipe
  68. restart_schedule 'web'
  69. # Logging
  70. log_history "$V_EVENT" "v_add_web_domain_cgi $user $domain"
  71. log_event 'system' "$V_EVENT"
  72. exit $OK