v_delete_web_domain_stat 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/bash
  2. # info: delete web domain statistics
  3. # options: user domain
  4. #
  5. # The function of deleting site's system of statistics. Its type is
  6. # automatically chooses from client's configuration file.
  7. #----------------------------------------------------------#
  8. # Variable&Function #
  9. #----------------------------------------------------------#
  10. # Argument defenition
  11. user=$1
  12. domain=$(idn -t --quiet -u "$2" )
  13. # Importing variables
  14. source $VESTA/conf/vars.conf
  15. source $V_CONF/vesta.conf
  16. source $V_FUNC/shared.func
  17. source $V_FUNC/domain.func
  18. #----------------------------------------------------------#
  19. # Verifications #
  20. #----------------------------------------------------------#
  21. # Checking arg number
  22. check_args '2' "$#" 'user domain'
  23. # Checking argument format
  24. format_validation 'user' 'domain'
  25. # Checking web system is enabled
  26. is_system_enabled 'web'
  27. # Checking user
  28. is_user_valid
  29. # Checking user is active
  30. is_user_suspended
  31. # Checking domain exist
  32. is_web_domain_valid
  33. # Checking domain is not suspened
  34. is_domain_suspended 'web'
  35. # Checking stats enabled
  36. is_web_domain_value_exist '$STATS'
  37. #----------------------------------------------------------#
  38. # Action #
  39. #----------------------------------------------------------#
  40. # Defining statistic type
  41. type=$(get_web_domain_value '$STATS')
  42. # Defining statistic dir
  43. stat_dir="$V_HOME/$user/web/$domain/stats"
  44. # Deleting dir content
  45. rm -rf $stat_dir/*
  46. # Deleting config
  47. rm -f $V_HOME/$user/conf/$type.$domain.conf
  48. #----------------------------------------------------------#
  49. # Vesta #
  50. #----------------------------------------------------------#
  51. # Deleting pipe command
  52. sed -i "/ $domain$/d" $V_QUEUE/stats.pipe
  53. # Deleting stats
  54. update_web_domain_value '$STATS' ''
  55. # Logging
  56. log_history "$V_EVENT" "v_add_web_domain_stat $user $doman $type"
  57. log_event 'system' "$V_EVENT"
  58. exit