Serghey Rodin 14 лет назад
Родитель
Сommit
242b5981f4
48 измененных файлов с 154 добавлено и 230 удалено
  1. 2 2
      bin/v_add_dns_domain_record
  2. 3 3
      bin/v_add_web_domain_alias
  3. 4 4
      bin/v_add_web_domain_cgi
  4. 4 4
      bin/v_add_web_domain_elog
  5. 5 5
      bin/v_add_web_domain_nginx
  6. 5 5
      bin/v_add_web_domain_ssl
  7. 4 4
      bin/v_add_web_domain_stat
  8. 3 3
      bin/v_add_web_domain_stat_auth
  9. 1 1
      bin/v_backup_user
  10. 3 3
      bin/v_change_dns_domain_exp
  11. 3 3
      bin/v_change_dns_domain_ip
  12. 1 1
      bin/v_change_dns_domain_record
  13. 3 3
      bin/v_change_dns_domain_soa
  14. 4 4
      bin/v_change_dns_domain_tpl
  15. 3 3
      bin/v_change_dns_domain_ttl
  16. 3 3
      bin/v_change_web_domain_ip
  17. 2 2
      bin/v_change_web_domain_sslcert
  18. 4 4
      bin/v_change_web_domain_sslhome
  19. 4 4
      bin/v_change_web_domain_tpl
  20. 3 3
      bin/v_delete_dns_domain
  21. 1 1
      bin/v_delete_dns_domain_record
  22. 2 2
      bin/v_delete_web_domain
  23. 3 3
      bin/v_delete_web_domain_alias
  24. 4 4
      bin/v_delete_web_domain_cgi
  25. 4 4
      bin/v_delete_web_domain_elog
  26. 5 5
      bin/v_delete_web_domain_nginx
  27. 4 4
      bin/v_delete_web_domain_ssl
  28. 4 4
      bin/v_delete_web_domain_stat
  29. 4 4
      bin/v_delete_web_domain_stat_auth
  30. 2 2
      bin/v_get_dns_domain_value
  31. 2 2
      bin/v_get_web_domain_value
  32. 1 1
      bin/v_list_dns_domain
  33. 1 1
      bin/v_list_web_domain
  34. 1 1
      bin/v_list_web_domain_ssl
  35. 7 7
      bin/v_rebuild_dns_domains
  36. 1 1
      bin/v_rebuild_web_domains
  37. 2 2
      bin/v_suspend_dns_domain
  38. 3 3
      bin/v_suspend_web_domain
  39. 2 2
      bin/v_unsuspend_dns_domain
  40. 1 1
      bin/v_unsuspend_dns_domains
  41. 3 3
      bin/v_unsuspend_web_domain
  42. 2 2
      bin/v_update_web_domain_disk
  43. 3 3
      bin/v_update_web_domain_stat
  44. 3 3
      bin/v_update_web_domain_traff
  45. 1 1
      bin/v_update_web_domains_disk
  46. 1 1
      bin/v_update_web_domains_stat
  47. 2 2
      bin/v_update_web_domains_traff
  48. 21 97
      func/domain.func

+ 2 - 2
bin/v_add_dns_domain_record

@@ -51,7 +51,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 # Checking domain is active
 # Checking domain is active
 is_domain_suspended 'dns'
 is_domain_suspended 'dns'
@@ -93,7 +93,7 @@ update_domain_zone
 
 
 # Updating dns domain values
 # Updating dns domain values
 records="$(wc -l $V_USERS/$user/dns/$domain)"
 records="$(wc -l $V_USERS/$user/dns/$domain)"
-update_dns_domain_value '$RECORDS' "$records"
+update_domain_value 'dns' '$RECORDS' "$records"
 
 
 # Updating user counters
 # Updating user counters
 increase_user_value "$user" '$U_DNS_RECORDS'
 increase_user_value "$user" '$U_DNS_RECORDS'

+ 3 - 3
bin/v_add_web_domain_alias

@@ -46,7 +46,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
@@ -71,7 +71,7 @@ is_package_full 'web_alias'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parsing domain values
 # Parsing domain values
-get_web_domain_values
+get_domain_values 'web'
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 
 
@@ -118,7 +118,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding new alias
 # Adding new alias
-update_web_domain_value '$ALIAS' "$ALIAS"
+update_domain_value 'web' '$ALIAS' "$ALIAS"
 
 
 # Update counters
 # Update counters
 increase_user_value "$user" '$U_WEB_ALIASES'
 increase_user_value "$user" '$U_WEB_ALIASES'

+ 4 - 4
bin/v_add_web_domain_cgi

@@ -44,13 +44,13 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Checking cgi is not added
 # Checking cgi is not added
-is_web_domain_key_empty '$CGI'
+is_domain_key_empty 'web' '$CGI'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -58,7 +58,7 @@ is_web_domain_key_empty '$CGI'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parsing domain values
 # Parsing domain values
-get_web_domain_values
+get_domain_values 'web'
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 CGI='yes'
 CGI='yes'
@@ -84,7 +84,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding elog in config
 # Adding elog in config
-update_web_domain_value '$CGI' 'yes'
+update_domain_value 'web' '$CGI' 'yes'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
 restart_schedule 'web'
 restart_schedule 'web'

+ 4 - 4
bin/v_add_web_domain_elog

@@ -42,13 +42,13 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Checking errorlog is not added
 # Checking errorlog is not added
-is_web_domain_key_empty '$ELOG'
+is_domain_key_empty 'web' '$ELOG'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -56,7 +56,7 @@ is_web_domain_key_empty '$ELOG'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parsing domain values
 # Parsing domain values
-get_web_domain_values
+get_domain_values 'web'
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 ELOG='yes'
 ELOG='yes'
@@ -98,7 +98,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding elog in config
 # Adding elog in config
-update_web_domain_value '$ELOG' 'yes'
+update_domain_value 'web' '$ELOG' 'yes'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
 restart_schedule 'web'
 restart_schedule 'web'

+ 5 - 5
bin/v_add_web_domain_nginx

@@ -46,13 +46,13 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Check nginx is not added
 # Check nginx is not added
-is_web_domain_key_empty '$NGINX'
+is_domain_key_empty 'web' '$NGINX'
 
 
 # Checking template
 # Checking template
 is_template_valid "proxy"
 is_template_valid "proxy"
@@ -63,7 +63,7 @@ is_template_valid "proxy"
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining domain parameters
 # Defining domain parameters
-get_web_domain_values
+get_domain_values 'web'
 NGINX="$template"
 NGINX="$template"
 NGINX_EXT="$extentions"
 NGINX_EXT="$extentions"
 tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
 tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
@@ -108,8 +108,8 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding nginx params to config
 # Adding nginx params to config
-update_web_domain_value '$NGINX' "$NGINX"
-update_web_domain_value '$NGINX_EXT' "$extentions"
+update_domain_value 'web' '$NGINX' "$NGINX"
+update_domain_value 'web' '$NGINX_EXT' "$extentions"
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
 restart_schedule 'web'
 restart_schedule 'web'

+ 5 - 5
bin/v_add_web_domain_ssl

@@ -49,7 +49,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
@@ -58,7 +58,7 @@ is_domain_suspended 'web'
 is_package_full 'web_ssl'
 is_package_full 'web_ssl'
 
 
 # Check ssl is not added
 # Check ssl is not added
-is_web_domain_key_empty '$SSL'
+is_domain_key_empty 'web' '$SSL'
 
 
 # Checking ssl certificate
 # Checking ssl certificate
 is_web_domain_cert_valid
 is_web_domain_cert_valid
@@ -79,7 +79,7 @@ fi
 chmod 660 $V_USERS/$user/ssl/$domain.*
 chmod 660 $V_USERS/$user/ssl/$domain.*
 
 
 # Parsing domain values
 # Parsing domain values
-get_web_domain_values
+get_domain_values 'web'
 conf="$V_HOME/$user/conf/web/shttpd.conf"
 conf="$V_HOME/$user/conf/web/shttpd.conf"
 tpl_file="$V_WEBTPL/apache_$TPL.stpl"
 tpl_file="$V_WEBTPL/apache_$TPL.stpl"
 SSL_HOME="$ssl_home"
 SSL_HOME="$ssl_home"
@@ -143,8 +143,8 @@ fi
 increase_user_value "$user" '$U_WEB_SSL'
 increase_user_value "$user" '$U_WEB_SSL'
 
 
 # Adding ssl values
 # Adding ssl values
-update_web_domain_value '$SSL_HOME' "$SSL_HOME"
-update_web_domain_value '$SSL' 'yes'
+update_domain_value 'web' '$SSL_HOME' "$SSL_HOME"
+update_domain_value 'web' '$SSL' 'yes'
 
 
 # Logging
 # Logging
 log_history "$V_EVENT" "v_delete_web_domain_ssl $user $domain"
 log_history "$V_EVENT" "v_delete_web_domain_ssl $user $domain"

+ 4 - 4
bin/v_add_web_domain_stat

@@ -46,7 +46,7 @@ is_user_valid "$user"
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
@@ -55,7 +55,7 @@ is_domain_suspended 'web'
 is_type_valid 'stat' "$type"
 is_type_valid 'stat' "$type"
 
 
 # Check statistic is not added
 # Check statistic is not added
-is_web_domain_key_empty '$STATS'
+is_domain_key_empty 'web' '$STATS'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -63,7 +63,7 @@ is_web_domain_key_empty '$STATS'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parse aliases
 # Parse aliases
-get_web_domain_values
+get_domain_values 'web'
 
 
 # Preparing domain values for the template substitution
 # Preparing domain values for the template substitution
 upd_web_domain_values
 upd_web_domain_values
@@ -92,7 +92,7 @@ cat $V_WEBTPL/$type.tpl |\
 echo "$V_BIN/v_update_web_domain_stat $user $domain" >> $V_QUEUE/stats.pipe
 echo "$V_BIN/v_update_web_domain_stat $user $domain" >> $V_QUEUE/stats.pipe
 
 
 # Adding stats in config
 # Adding stats in config
-update_web_domain_value '$STATS' "$type"
+update_domain_value 'web' '$STATS' "$type"
 
 
 # Logging
 # Logging
 log_history "$V_EVENT" "v_delete_web_domain_stat $user $domain"
 log_history "$V_EVENT" "v_delete_web_domain_stat $user $domain"

+ 3 - 3
bin/v_add_web_domain_stat_auth

@@ -42,7 +42,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
@@ -77,7 +77,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Get current value
 # Get current value
-curr_val=$(get_web_domain_value '$STATS_AUTH')
+curr_val=$(get_domain_value 'web' '$STATS_AUTH')
 check_uniq=$(echo "$curr_val" | grep -w "$auth_user")
 check_uniq=$(echo "$curr_val" | grep -w "$auth_user")
 
 
 # Checking current users
 # Checking current users
@@ -92,7 +92,7 @@ else
 fi
 fi
 
 
 # Adding stats user in config
 # Adding stats user in config
-update_web_domain_value '$STATS_AUTH' "$a_users"
+update_domain_value 'web' '$STATS_AUTH' "$a_users"
 
 
 # Hiding password
 # Hiding password
 V_EVENT="$V_DATE $V_SCRIPT $user $domain $auth_user *****"
 V_EVENT="$V_DATE $V_SCRIPT $user $domain $auth_user *****"

+ 1 - 1
bin/v_backup_user

@@ -160,7 +160,7 @@ then
 
 
         # Defining domain variables
         # Defining domain variables
         domain_idn=$(idn -t --quiet -a "$domain")
         domain_idn=$(idn -t --quiet -a "$domain")
-        get_web_domain_values
+        get_domain_values 'web'
 
 
         # Packing data folders
         # Packing data folders
         cd $V_HOME/$user/web/$domain
         cd $V_HOME/$user/web/$domain

+ 3 - 3
bin/v_change_dns_domain_exp

@@ -43,7 +43,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'dns'
 is_domain_suspended 'dns'
@@ -54,10 +54,10 @@ is_domain_suspended 'dns'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Get old expiriation date
 # Get old expiriation date
-old_exp=$(get_dns_domain_value '$EXP')
+old_exp=$(get_domain_value 'dns' '$EXP')
 
 
 # Changing exp
 # Changing exp
-update_dns_domain_value '$EXP' "$exp"
+update_domain_value 'dns' '$EXP' "$exp"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#

+ 3 - 3
bin/v_change_dns_domain_ip

@@ -41,7 +41,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'dns'
 is_domain_suspended 'dns'
@@ -52,10 +52,10 @@ is_domain_suspended 'dns'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Get old ip
 # Get old ip
-old_ip=$(get_dns_domain_value '$IP')
+old_ip=$(get_domain_value 'dns' '$IP')
 
 
 # Changing ip
 # Changing ip
-update_dns_domain_value '$IP' "$ip"
+update_domain_value 'dns' '$IP' "$ip"
 
 
 # Changing records
 # Changing records
 sed -i "s/$old_ip/$ip/g" $V_USERS/$user/dns/$domain
 sed -i "s/$old_ip/$ip/g" $V_USERS/$user/dns/$domain

+ 1 - 1
bin/v_change_dns_domain_record

@@ -45,7 +45,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'dns'
 is_domain_suspended 'dns'

+ 3 - 3
bin/v_change_dns_domain_soa

@@ -42,7 +42,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'dns'
 is_domain_suspended 'dns'
@@ -53,10 +53,10 @@ is_domain_suspended 'dns'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Get old soa
 # Get old soa
-old_soa=$(get_dns_domain_value '$SOA')
+old_soa=$(get_domain_value 'dns' '$SOA')
 
 
 # Changing soa
 # Changing soa
-update_dns_domain_value '$SOA' "$soa"
+update_domain_value 'dns' '$SOA' "$soa"
 
 
 # Updating zone
 # Updating zone
 update_domain_zone
 update_domain_zone

+ 4 - 4
bin/v_change_dns_domain_tpl

@@ -44,7 +44,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'dns'
 is_domain_suspended 'dns'
@@ -58,13 +58,13 @@ is_template_valid 'dns'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Get vals
 # Get vals
-old_tpl=$(get_dns_domain_value '$TPL')
-ip=$(get_dns_domain_value '$IP')
+old_tpl=$(get_domain_value 'dns' '$TPL')
+ip=$(get_domain_value 'dns' '$IP')
 ns1=$(get_user_value '$NS1')
 ns1=$(get_user_value '$NS1')
 ns2=$(get_user_value '$NS2')
 ns2=$(get_user_value '$NS2')
 
 
 # Changing tpl
 # Changing tpl
-update_dns_domain_value '$TPL' "$template"
+update_domain_value 'dns' '$TPL' "$template"
 
 
 cat $V_DNSTPL/$template.tpl |\
 cat $V_DNSTPL/$template.tpl |\
     sed -e "s/%ip%/$ip/g" \
     sed -e "s/%ip%/$ip/g" \

+ 3 - 3
bin/v_change_dns_domain_ttl

@@ -42,7 +42,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'dns'
 is_domain_suspended 'dns'
@@ -53,10 +53,10 @@ is_domain_suspended 'dns'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Get old ttl
 # Get old ttl
-old_ttl=$(get_dns_domain_value '$TTL')
+old_ttl=$(get_domain_value 'dns' '$TTL')
 
 
 # Changing ttl
 # Changing ttl
-update_dns_domain_value '$TTL' "$ttl"
+update_domain_value 'dns' '$TTL' "$ttl"
 
 
 # Updating zone
 # Updating zone
 update_domain_zone
 update_domain_zone

+ 3 - 3
bin/v_change_web_domain_ip

@@ -44,7 +44,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
@@ -58,7 +58,7 @@ is_ip_avalable
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Define variable for replace
 # Define variable for replace
-get_web_domain_values
+get_domain_values 'web'
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 old=$IP
 old=$IP
@@ -98,7 +98,7 @@ increase_ip_value "$new"
 decrease_ip_value "$old"
 decrease_ip_value "$old"
 
 
 # Adding ip in config
 # Adding ip in config
-update_web_domain_value '$IP' "$new"
+update_domain_value 'web' '$IP' "$new"
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
 restart_schedule 'web'
 restart_schedule 'web'

+ 2 - 2
bin/v_change_web_domain_sslcert

@@ -43,13 +43,13 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Check SSL is added
 # Check SSL is added
-is_web_domain_value_exist '$SSL'
+is_domain_value_exist 'web' '$SSL'
 
 
 # Checking ssl certificate
 # Checking ssl certificate
 is_web_domain_cert_valid
 is_web_domain_cert_valid

+ 4 - 4
bin/v_change_web_domain_sslhome

@@ -38,13 +38,13 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Check SSL is added
 # Check SSL is added
-is_web_domain_value_exist '$SSL'
+is_domain_value_exist 'web' '$SSL'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -52,7 +52,7 @@ is_web_domain_value_exist '$SSL'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Get domain values
 # Get domain values
-get_web_domain_values
+get_domain_values 'web'
 old_ssl_home=$SSL_HOME
 old_ssl_home=$SSL_HOME
 SSL_HOME=$ssl_home
 SSL_HOME=$ssl_home
 tpl_file="$V_WEBTPL/apache_$TPL.stpl"
 tpl_file="$V_WEBTPL/apache_$TPL.stpl"
@@ -83,7 +83,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding sslhome in config
 # Adding sslhome in config
-update_web_domain_value '$SSL_HOME' "$SSL_HOME"
+update_domain_value 'web' '$SSL_HOME' "$SSL_HOME"
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
 restart_schedule 'web'
 restart_schedule 'web'

+ 4 - 4
bin/v_change_web_domain_tpl

@@ -43,7 +43,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
@@ -58,7 +58,7 @@ is_template_valid "web"
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parsing domain values
 # Parsing domain values
-get_web_domain_values
+get_domain_values 'web'
 
 
 # Deleting domain
 # Deleting domain
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
@@ -177,13 +177,13 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Changing tpl in config
 # Changing tpl in config
-update_web_domain_value '$TPL' "$template"
+update_domain_value 'web' '$TPL' "$template"
 
 
 # Updating db keys
 # Updating db keys
 for keys in $(cat $V_WEBTPL/apache_$template.descr|grep -v '#'); do
 for keys in $(cat $V_WEBTPL/apache_$template.descr|grep -v '#'); do
     key=$(echo "$keys"| cut -f 1 -d '=' |sed -e "s/^/\$/g")
     key=$(echo "$keys"| cut -f 1 -d '=' |sed -e "s/^/\$/g")
     value=$(echo "$keys" |cut -f 2 -d \')
     value=$(echo "$keys" |cut -f 2 -d \')
-    update_web_domain_value "$key" "$value"
+    update_domain_value 'web' "$key" "$value"
 done
 done
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe

+ 3 - 3
bin/v_delete_dns_domain

@@ -42,7 +42,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -50,8 +50,8 @@ is_dns_domain_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Get template name
 # Get template name
-tpl_name=$(get_dns_domain_value '$TPL')
-old_ip=$(get_dns_domain_value '$IP')
+tpl_name=$(get_domain_value 'dns' '$TPL')
+old_ip=$(get_domain_value 'dns' '$IP')
 
 
 # Deleting domain in named.conf
 # Deleting domain in named.conf
 rm_string=$(grep -n /conf/dns/$domain.db $named_conf |cut -d : -f 1)
 rm_string=$(grep -n /conf/dns/$domain.db $named_conf |cut -d : -f 1)

+ 1 - 1
bin/v_delete_dns_domain_record

@@ -39,7 +39,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'dns'
 is_domain_suspended 'dns'

+ 2 - 2
bin/v_delete_web_domain

@@ -45,7 +45,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
@@ -56,7 +56,7 @@ is_domain_suspended 'web'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Get template name
 # Get template name
-get_web_domain_values
+get_domain_values 'web'
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 
 

+ 3 - 3
bin/v_delete_web_domain_alias

@@ -44,13 +44,13 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Checking alias is added
 # Checking alias is added
-get_web_domain_values
+get_domain_values 'web'
 check_alias=$(echo ${ALIAS//,/ }|grep -w "$dom_alias")
 check_alias=$(echo ${ALIAS//,/ }|grep -w "$dom_alias")
 if [ -z "$check_alias" ]; then
 if [ -z "$check_alias" ]; then
     echo "Error: alias not exist"
     echo "Error: alias not exist"
@@ -107,7 +107,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Deleting alias
 # Deleting alias
-update_web_domain_value '$ALIAS' "$ALIAS"
+update_domain_value 'web' '$ALIAS' "$ALIAS"
 
 
 # Update counters
 # Update counters
 decrease_user_value "$user" '$U_WEB_ALIASES'
 decrease_user_value "$user" '$U_WEB_ALIASES'

+ 4 - 4
bin/v_delete_web_domain_cgi

@@ -44,20 +44,20 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Checking cgi is added
 # Checking cgi is added
-is_web_domain_value_exist '$CGI'
+is_domain_value_exist 'web' '$CGI'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                       Action                             #
 #                       Action                             #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-get_web_domain_values
+get_domain_values 'web'
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 CGI='no'
 CGI='no'
@@ -83,7 +83,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Deleting cgi in config
 # Deleting cgi in config
-update_web_domain_value '$CGI' 'no'
+update_domain_value 'web' '$CGI' 'no'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
 restart_schedule 'web'
 restart_schedule 'web'

+ 4 - 4
bin/v_delete_web_domain_elog

@@ -43,13 +43,13 @@ is_user_valid "$user"
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Check errorlog is added
 # Check errorlog is added
-is_web_domain_value_exist '$ELOG'
+is_domain_value_exist 'web' '$ELOG'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -57,7 +57,7 @@ is_web_domain_value_exist '$ELOG'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parsing domain values
 # Parsing domain values
-get_web_domain_values
+get_domain_values 'web'
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 ELOG='no'
 ELOG='no'
@@ -99,7 +99,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Deleting elog in config
 # Deleting elog in config
-update_web_domain_value '$ELOG' 'no'
+update_domain_value 'web' '$ELOG' 'no'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
 restart_schedule 'web'
 restart_schedule 'web'

+ 5 - 5
bin/v_delete_web_domain_nginx

@@ -41,13 +41,13 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Checking ssl is added
 # Checking ssl is added
-is_web_domain_value_exist '$NGINX'
+is_domain_value_exist 'web' '$NGINX'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -55,7 +55,7 @@ is_web_domain_value_exist '$NGINX'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining domain parameters
 # Defining domain parameters
-get_web_domain_values
+get_domain_values 'web'
 tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
 tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
 conf="$V_HOME/$user/conf/nginx.conf"
 conf="$V_HOME/$user/conf/nginx.conf"
 del_web_config
 del_web_config
@@ -73,8 +73,8 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Deleting nginx keys
 # Deleting nginx keys
-update_web_domain_value '$NGINX' ''
-update_web_domain_value '$NGINX_EXT' ''
+update_domain_value 'web' '$NGINX' ''
+update_domain_value 'web' '$NGINX_EXT' ''
 
 
 # Checking last nginx domain
 # Checking last nginx domain
 conf='/etc/nginx/conf.d/vesta_users.conf'
 conf='/etc/nginx/conf.d/vesta_users.conf'

+ 4 - 4
bin/v_delete_web_domain_ssl

@@ -41,13 +41,13 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Checking ssl is added
 # Checking ssl is added
-is_web_domain_value_exist '$SSL'
+is_domain_value_exist 'web' '$SSL'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -55,7 +55,7 @@ is_web_domain_value_exist '$SSL'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parsing domain values
 # Parsing domain values
-get_web_domain_values
+get_domain_values 'web'
 conf="$V_HOME/$user/conf/web/shttpd.conf"
 conf="$V_HOME/$user/conf/web/shttpd.conf"
 tpl_file="$V_WEBTPL/apache_$TPL.stpl"
 tpl_file="$V_WEBTPL/apache_$TPL.stpl"
 
 
@@ -81,7 +81,7 @@ chown -R $user:$user $tmpdir
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Deleting ssl in config
 # Deleting ssl in config
-update_web_domain_value '$SSL' 'no'
+update_domain_value 'web' '$SSL' 'no'
 
 
 # Checking last ssl domain
 # Checking last ssl domain
 ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web.conf)
 ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web.conf)

+ 4 - 4
bin/v_delete_web_domain_stat

@@ -41,13 +41,13 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Checking stats enabled
 # Checking stats enabled
-is_web_domain_value_exist '$STATS'
+is_domain_value_exist 'web' '$STATS'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -55,7 +55,7 @@ is_web_domain_value_exist '$STATS'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining statistic type
 # Defining statistic type
-type=$(get_web_domain_value '$STATS')
+type=$(get_domain_value 'web' '$STATS')
 
 
 # Defining statistic dir
 # Defining statistic dir
 stat_dir="$V_HOME/$user/web/$domain/stats"
 stat_dir="$V_HOME/$user/web/$domain/stats"
@@ -75,7 +75,7 @@ rm -f $V_HOME/$user/conf/$type.$domain.conf
 sed -i "/ $domain$/d" $V_QUEUE/stats.pipe
 sed -i "/ $domain$/d" $V_QUEUE/stats.pipe
 
 
 # Deleting stats
 # Deleting stats
-update_web_domain_value '$STATS' ''
+update_domain_value 'web' '$STATS' ''
 
 
 # Logging
 # Logging
 log_history "$V_EVENT" "v_add_web_domain_stat $user $doman $type"
 log_history "$V_EVENT" "v_add_web_domain_stat $user $doman $type"

+ 4 - 4
bin/v_delete_web_domain_stat_auth

@@ -44,13 +44,13 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Checking stats auth enabled
 # Checking stats auth enabled
-is_web_domain_value_exist '$STATS_AUTH'
+is_domain_value_exist 'web' '$STATS_AUTH'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -81,7 +81,7 @@ fi
 # Checking auth_user
 # Checking auth_user
 if [ ! -z "$auth_user" ]; then
 if [ ! -z "$auth_user" ]; then
     # Get current value
     # Get current value
-    curr_val=$(get_web_domain_value '$STATS_AUTH')
+    curr_val=$(get_domain_value 'web' '$STATS_AUTH')
 
 
     # Deleteting auth_user
     # Deleteting auth_user
     new_val=$(echo "$curr_val" |\
     new_val=$(echo "$curr_val" |\
@@ -101,7 +101,7 @@ else
 fi
 fi
 
 
 # Deleting stats auth_user
 # Deleting stats auth_user
-update_web_domain_value '$STATS_AUTH' "$new_val"
+update_domain_value 'web' '$STATS_AUTH' "$new_val"
 
 
 # Logging
 # Logging
 log_history "$V_EVENT"
 log_history "$V_EVENT"

+ 2 - 2
bin/v_get_dns_domain_value

@@ -36,7 +36,7 @@ format_validation 'user' 'domain'
 is_user_valid
 is_user_valid
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'dns'
 is_domain_suspended 'dns'
@@ -47,7 +47,7 @@ is_domain_suspended 'dns'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Checking key
 # Checking key
-value=$(get_dns_domain_value "$key")
+value=$(get_domain_value 'dns' "$key")
 
 
 # Printing value
 # Printing value
 echo "$value"
 echo "$value"

+ 2 - 2
bin/v_get_web_domain_value

@@ -41,7 +41,7 @@ is_user_valid
 is_user_suspended
 is_user_suspended
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
@@ -51,7 +51,7 @@ is_domain_suspended 'web'
 #                       Action                             #
 #                       Action                             #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-value=$(get_web_domain_value "$key")
+value=$(get_domain_value 'web' "$key")
 echo "$value"
 echo "$value"
 
 
 
 

+ 1 - 1
bin/v_list_dns_domain

@@ -110,7 +110,7 @@ format_validation 'user' 'domain'
 is_user_valid
 is_user_valid
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#

+ 1 - 1
bin/v_list_web_domain

@@ -85,7 +85,7 @@ check_args '2' "$#" 'user domain [format]'
 is_user_valid
 is_user_valid
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#

+ 1 - 1
bin/v_list_web_domain_ssl

@@ -56,7 +56,7 @@ check_args '2' "$#" 'user domain [format]'
 is_user_valid
 is_user_valid
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#

+ 7 - 7
bin/v_rebuild_dns_domains

@@ -78,12 +78,12 @@ for domain in $domains; do
 
 
     # Defining variables
     # Defining variables
     domain_idn=$(idn -t --quiet -a "$domain")
     domain_idn=$(idn -t --quiet -a "$domain")
-    ip="$(get_dns_domain_value '$IP')"
-    template="$(get_dns_domain_value '$TPL')"
-    exp="$(get_dns_domain_value '$EXP')"
-    soa="$(get_dns_domain_value '$SOA')"
-    ttl="$(get_dns_domain_value '$TTL')"
-    suspended="$(get_dns_domain_value '$SUSPENDED')"
+    ip="$(get_domain_value 'dns' '$IP')"
+    template="$(get_domain_value 'dns' '$TPL')"
+    exp="$(get_domain_value 'dns' '$EXP')"
+    soa="$(get_domain_value 'dns' '$SOA')"
+    ttl="$(get_domain_value 'dns' '$TTL')"
+    suspended="$(get_domain_value 'dns' '$SUSPENDED')"
 
 
     # Checking zone file
     # Checking zone file
     if [ ! -e "$V_USERS/$user/dns/$domain" ]; then
     if [ ! -e "$V_USERS/$user/dns/$domain" ]; then
@@ -130,7 +130,7 @@ for domain in $domains; do
     fi
     fi
     records=$(wc -l $V_USERS/$user/dns/$domain | cut -f 1 -d ' ')
     records=$(wc -l $V_USERS/$user/dns/$domain | cut -f 1 -d ' ')
     user_records=$((user_records + records))
     user_records=$((user_records + records))
-    update_dns_domain_value '$RECORDS' "$records"
+    update_domain_value 'dns' '$RECORDS' "$records"
 done
 done
 
 
 
 

+ 1 - 1
bin/v_rebuild_web_domains

@@ -58,7 +58,7 @@ for domain in $(shell_list) ; do
     domain_idn=$(idn -t --quiet -a "$domain")
     domain_idn=$(idn -t --quiet -a "$domain")
 
 
     # Parsing domain values
     # Parsing domain values
-    get_web_domain_values
+    get_domain_values 'web'
 
 
     # Preparing domain values for the template substitution
     # Preparing domain values for the template substitution
     upd_web_domain_values
     upd_web_domain_values

+ 2 - 2
bin/v_suspend_dns_domain

@@ -38,7 +38,7 @@ is_system_enabled 'dns'
 is_user_valid
 is_user_valid
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'dns'
 is_domain_suspended 'dns'
@@ -62,7 +62,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding suspend in config
 # Adding suspend in config
-update_dns_domain_value '$SUSPENDED' 'yes'
+update_domain_value 'dns' '$SUSPENDED' 'yes'
 increase_user_value "$user" '$SUSPENDED_DNS'
 increase_user_value "$user" '$SUSPENDED_DNS'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe

+ 3 - 3
bin/v_suspend_web_domain

@@ -43,7 +43,7 @@ is_system_enabled 'web'
 is_user_valid
 is_user_valid
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
@@ -54,7 +54,7 @@ is_domain_suspended 'web'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parsing domain values
 # Parsing domain values
-get_web_domain_values
+get_domain_values 'web'
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 SUSPENDED='yes'
 SUSPENDED='yes'
@@ -96,7 +96,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding suspend in config
 # Adding suspend in config
-update_web_domain_value '$SUSPENDED' 'yes'
+update_domain_value 'web' '$SUSPENDED' 'yes'
 increase_user_value "$user" '$SUSPENDED_WEB'
 increase_user_value "$user" '$SUSPENDED_WEB'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe

+ 2 - 2
bin/v_unsuspend_dns_domain

@@ -38,7 +38,7 @@ is_system_enabled 'dns'
 is_user_valid
 is_user_valid
 
 
 # Checking domain exist
 # Checking domain exist
-is_dns_domain_valid
+is_domain_valid 'dns'
 
 
 # Check domain is suspened
 # Check domain is suspened
 is_domain_unsuspended 'dns'
 is_domain_unsuspended 'dns'
@@ -60,7 +60,7 @@ echo "$nmd_rec" >> $conf
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Unsuspending domain in config
 # Unsuspending domain in config
-update_dns_domain_value '$SUSPENDED' 'no'
+update_domain_value 'dns' '$SUSPENDED' 'no'
 decrease_user_value "$user" '$SUSPENDED_DNS'
 decrease_user_value "$user" '$SUSPENDED_DNS'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe

+ 1 - 1
bin/v_unsuspend_dns_domains

@@ -64,7 +64,7 @@ for domain in $domains; do
     echo "$rec" >> $conf
     echo "$rec" >> $conf
 
 
     # Unsuspendin in config
     # Unsuspendin in config
-    update_dns_domain_value '$SUSPENDED' 'no'
+    update_domain_value 'dns' '$SUSPENDED' 'no'
 
 
 done
 done
 
 

+ 3 - 3
bin/v_unsuspend_web_domain

@@ -38,7 +38,7 @@ is_system_enabled 'web'
 is_user_valid
 is_user_valid
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Check domain is suspened
 # Check domain is suspened
 is_domain_unsuspended 'web'
 is_domain_unsuspended 'web'
@@ -49,7 +49,7 @@ is_domain_unsuspended 'web'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parsing domain values
 # Parsing domain values
-get_web_domain_values
+get_domain_values 'web'
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 tpl_file="$V_WEBTPL/apache_$TPL.tpl"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 conf="$V_HOME/$user/conf/web/httpd.conf"
 SUSPENDED='no'
 SUSPENDED='no'
@@ -91,7 +91,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Updating suspend keys
 # Updating suspend keys
-update_web_domain_value '$SUSPENDED' 'no'
+update_domain_value 'web' '$SUSPENDED' 'no'
 decrease_user_value "$user" '$SUSPENDED_WEB'
 decrease_user_value "$user" '$SUSPENDED_WEB'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe

+ 2 - 2
bin/v_update_web_domain_disk

@@ -38,7 +38,7 @@ is_system_enabled 'web'
 is_user_valid
 is_user_valid
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
@@ -62,7 +62,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Updating disk value in config
 # Updating disk value in config
-update_web_domain_value '$U_DISK' "$disk_usage"
+update_domain_value 'web' '$U_DISK' "$disk_usage"
 
 
 # Recalculating user disk space
 # Recalculating user disk space
 disk_size=$(get_usr_disk)
 disk_size=$(get_usr_disk)

+ 3 - 3
bin/v_update_web_domain_stat

@@ -38,20 +38,20 @@ is_system_enabled 'web'
 is_user_valid
 is_user_valid
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Checking stats enabled
 # Checking stats enabled
-is_web_domain_value_exist '$STATS'
+is_domain_value_exist 'web' '$STATS'
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                       Action                             #
 #                       Action                             #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-stats=$(get_web_domain_value '$STATS')
+stats=$(get_domain_value 'web' '$STATS')
 
 
 # Checking config
 # Checking config
 config="$V_HOME/$user/conf/web/$stats.$domain.conf"
 config="$V_HOME/$user/conf/web/$stats.$domain.conf"

+ 3 - 3
bin/v_update_web_domain_traff

@@ -38,7 +38,7 @@ is_system_enabled 'web'
 is_user_valid
 is_user_valid
 
 
 # Checking domain exist
 # Checking domain exist
-is_web_domain_valid
+is_domain_valid 'web'
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
 is_domain_suspended 'web'
 is_domain_suspended 'web'
@@ -75,13 +75,13 @@ echo > $log_file
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parsing old value
 # Parsing old value
-old_val=$(get_web_domain_value '$U_BANDWIDTH')
+old_val=$(get_domain_value 'web' '$U_BANDWIDTH')
 
 
 # Defining new value
 # Defining new value
 bandwidth=$((old_val + mb))
 bandwidth=$((old_val + mb))
 
 
 # Updating bandwidth value in config
 # Updating bandwidth value in config
-update_web_domain_value '$U_BANDWIDTH' "$bandwidth"
+update_domain_value 'web' '$U_BANDWIDTH' "$bandwidth"
 
 
 # Logging
 # Logging
 log_event 'system' "$V_EVENT"
 log_event 'system' "$V_EVENT"

+ 1 - 1
bin/v_update_web_domains_disk

@@ -60,7 +60,7 @@ for domain in $domains; do
     fi
     fi
 
 
     # Updating disk value in config
     # Updating disk value in config
-    update_web_domain_value '$U_DISK' "$disk_usage"
+    update_domain_value 'web' '$U_DISK' "$disk_usage"
 done
 done
 
 
 
 

+ 1 - 1
bin/v_update_web_domains_stat

@@ -50,7 +50,7 @@ domains=$(dom_clear_search)
 
 
 # Starting upd loop
 # Starting upd loop
 for domain in $domains; do
 for domain in $domains; do
-    stats=$(get_web_domain_value '$STATS')
+    stats=$(get_domain_value 'web' '$STATS')
     if [ ! -z "$stats" ]; then
     if [ ! -z "$stats" ]; then
         $V_BIN/v_update_web_domain_stat "$user" "$domain"
         $V_BIN/v_update_web_domain_stat "$user" "$domain"
         rv="$?"
         rv="$?"

+ 2 - 2
bin/v_update_web_domains_traff

@@ -75,13 +75,13 @@ for domain in $domains; do
     echo > $log_file
     echo > $log_file
 
 
     # Parsing old value
     # Parsing old value
-    old_val=$(get_web_domain_value '$U_BANDWIDTH')
+    old_val=$(get_domain_value 'web' '$U_BANDWIDTH')
 
 
     # Defining new value
     # Defining new value
     bandwidth=$((old_val + mb))
     bandwidth=$((old_val + mb))
 
 
     # Updating bandwidth value in config
     # Updating bandwidth value in config
-    update_web_domain_value '$U_BANDWIDTH' "$bandwidth"
+    update_domain_value 'web' '$U_BANDWIDTH' "$bandwidth"
 
 
 done
 done
 
 

+ 21 - 97
func/domain.func

@@ -24,7 +24,6 @@ is_domain_new() {
         fi
         fi
         return $E_EXISTS
         return $E_EXISTS
     fi
     fi
-
 }
 }
 
 
 is_domain_owner() {
 is_domain_owner() {
@@ -80,21 +79,9 @@ is_web_domain_free() {
     fi
     fi
 }
 }
 
 
-is_dns_domain_valid() {
-    # Parsing domain values
-    check_domain=$(grep -F "DOMAIN='$domain'" $V_USERS/$user/dns.conf)
-
-    # Checking result
-    if [ -z "$check_domain" ]; then
-        echo "Error: domain not exist"
-        log_event 'debug' "$E_NOTEXIST $V_EVENT"
-        exit $E_NOTEXIST
-    fi
-}
-
-is_web_domain_valid() {
+is_domain_valid() {
     # Parsing domain values
     # Parsing domain values
-    check_domain=$(grep -F "DOMAIN='$domain'" $V_USERS/$user/web.conf)
+    check_domain=$(grep -F "DOMAIN='$domain'" $V_USERS/$user/$1.conf)
 
 
     # Checking result
     # Checking result
     if [ -z "$check_domain" ]; then
     if [ -z "$check_domain" ]; then
@@ -315,11 +302,12 @@ replace_web_config() {
     sed -i  "$top_line,$bottom_line s/$clean_old/$clean_new/" $conf
     sed -i  "$top_line,$bottom_line s/$clean_old/$clean_new/" $conf
 }
 }
 
 
-get_web_domain_value() {
-    key="$1"
+get_domain_value() {
+    domain_type="$1"
+    key="$2"
 
 
     # Parsing domains
     # Parsing domains
-    string=$( grep "DOMAIN='$domain'" $V_USERS/$user/web.conf )
+    string=$( grep "DOMAIN='$domain'" $V_USERS/$user/$domain_type.conf )
 
 
     # Parsing key=value
     # Parsing key=value
     eval $string
     eval $string
@@ -331,36 +319,21 @@ get_web_domain_value() {
     echo "$value"
     echo "$value"
 }
 }
 
 
-get_web_domain_values() {
+get_domain_values() {
     # Defining domain parameters
     # Defining domain parameters
-    for line in $(grep "DOMAIN='$domain'" $V_USERS/$user/web.conf); do
+    for line in $(grep "DOMAIN='$domain'" $V_USERS/$user/$1.conf); do
         # Assing key=value
         # Assing key=value
         eval $line
         eval $line
     done
     done
 }
 }
 
 
-get_dns_domain_value() {
-    key="$1"
-
-    # Parsing domains
-    string=$( grep "DOMAIN='$domain'" $V_USERS/$user/dns.conf )
-
-    # Parsing key=value
-    eval $string
-
-    # Self reference
-    eval value="$key"
-
-    # Print value
-    echo "$value"
-}
-
-update_web_domain_value() {
-    key="$1"
-    value="$2"
+update_domain_value() {
+    domain_type="$1"
+    key="$2"
+    value="$3"
 
 
     # Defining conf
     # Defining conf
-    conf="$V_USERS/$user/web.conf"
+    conf="$V_USERS/$user/$domain_type.conf"
 
 
     # Parsing conf
     # Parsing conf
     domain_str=$(grep -n "DOMAIN='$domain'" $conf)
     domain_str=$(grep -n "DOMAIN='$domain'" $conf)
@@ -384,40 +357,12 @@ update_web_domain_value() {
      $conf
      $conf
 }
 }
 
 
-update_dns_domain_value() {
-    key="$1"
-    value="$2"
-
-    # Defining conf
-    conf="$V_USERS/$user/dns.conf"
-
-    # Parsing conf
-    domain_str=$(grep -n "DOMAIN='$domain'" $conf)
-    str_number=$(echo $domain_str | cut -f 1 -d ':')
-    str=$(echo $domain_str | cut -f 2 -d ':')
-
-    # Reading key=values
-    eval $str
-
-    # Defining clean key
-    c_key=$(echo "${key//$/}")
-
-    eval old="${key}"
-
-    # Escaping slashes
-    old=$(echo "$old" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g')
-    new=$(echo "$value" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g')
-
-    # Updating conf
-    sed -i "$str_number s/$c_key='${old//\*/\\*}'/$c_key='${new//\*/\\*}'/g"\
-     $conf
-}
-
-is_web_domain_key_empty() {
-    key="$1"
+is_domain_key_empty() {
+    domain_type="$1"
+    key="$2"
 
 
     # Parsing domains
     # Parsing domains
-    string=$( grep "DOMAIN='$domain'" $V_USERS/$user/web.conf )
+    string=$( grep "DOMAIN='$domain'" $V_USERS/$user/$domain_type.conf )
 
 
     # Parsing key=value
     # Parsing key=value
     eval $string
     eval $string
@@ -483,7 +428,6 @@ is_web_domain_cert_valid() {
     fi
     fi
 }
 }
 
 
-
 is_dns_record_valid() {
 is_dns_record_valid() {
     # Checking record id
     # Checking record id
     check_id=$(grep "^ID='$id'" $V_USERS/$user/dns/$domain)
     check_id=$(grep "^ID='$id'" $V_USERS/$user/dns/$domain)
@@ -495,11 +439,12 @@ is_dns_record_valid() {
     fi
     fi
 }
 }
 
 
-is_web_domain_value_exist() {
-    key="$1"
+is_domain_value_exist() {
+    domain_type="$1"
+    key="$2"
 
 
     # Parsing domains
     # Parsing domains
-    string=$( grep "DOMAIN='$domain'" $V_USERS/$user/web.conf )
+    string=$( grep "DOMAIN='$domain'" $V_USERS/$user/$domain_type.conf )
 
 
     # Parsing key=value
     # Parsing key=value
     eval $string
     eval $string
@@ -515,27 +460,6 @@ is_web_domain_value_exist() {
     fi
     fi
 }
 }
 
 
-is_dns_domain_value_exist() {
-    key="$1"
-
-    # Parsing domains
-    string=$( grep "DOMAIN='$domain'" $V_USERS/$user/dns.conf )
-
-    # Parsing key=value
-    eval $string
-
-    # Self reference
-    eval value="$key"
-
-    # Checking result
-    if [ -z "$value" ] || [ "$value" = 'no' ]; then
-        echo "Error: ${key//$/} is empty"
-        log_event 'debug' "$E_NOTEXIST $V_EVENT"
-        exit $E_EXISTS
-    fi
-}
-
-
 del_web_config() {
 del_web_config() {
     # Get config borders
     # Get config borders
     get_web_config_brds || exit $?
     get_web_config_brds || exit $?