v_delete_web_domain_stats 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. # Includes
  14. source $VESTA/conf/vesta.conf
  15. source $VESTA/func/main.sh
  16. source $VESTA/func/domain.sh
  17. #----------------------------------------------------------#
  18. # Verifications #
  19. #----------------------------------------------------------#
  20. check_args '2' "$#" 'user domain'
  21. validate_format 'user' 'domain'
  22. is_system_enabled "$WEB_SYSTEM"
  23. is_object_valid 'user' 'USER' "$user"
  24. is_object_unsuspended 'user' 'USER' "$user"
  25. is_object_valid 'web' 'DOMAIN' "$domain"
  26. is_object_unsuspended 'web' 'DOMAIN' "$domain"
  27. is_object_value_exist 'web' 'DOMAIN' "$domain" '$STATS'
  28. #----------------------------------------------------------#
  29. # Action #
  30. #----------------------------------------------------------#
  31. # Defining statistic type
  32. get_domain_values 'web'
  33. # Defining statistic dir
  34. stats_dir="$HOMEDIR/$user/web/$domain/stats"
  35. # Deleting dir content
  36. rm -rf $stats_dir/*
  37. # Deleting config
  38. rm -f $HOMEDIR/$user/conf/web/$STATS.$domain.conf
  39. #----------------------------------------------------------#
  40. # Vesta #
  41. #----------------------------------------------------------#
  42. # Deleting pipe command
  43. sed -i "/ $domain$/d" $V_QUEUE/stats.pipe
  44. # Update config
  45. update_object_value 'web' 'DOMAIN' "$domain" '$STATS' ''
  46. # Logging
  47. log_history "$EVENT"
  48. log_event "$OK" "$EVENT"
  49. exit