diff --git a/bin/v_add_dns_domain b/bin/v_add_dns_domain index 6992bb119..66d7522eb 100755 --- a/bin/v_add_dns_domain +++ b/bin/v_add_dns_domain @@ -100,9 +100,11 @@ cat $V_DNSTPL/$template.tpl |\ -e "s/%ns8%/$ns8/g" \ -e "s/%date%/$V_DATE/g" > $V_USERS/$user/dns/$domain +records="$(wc -l $V_USERS/$user/dns/$domain)" + # Adding dns.conf record dns_rec="DOMAIN='$domain' IP='$ip' TPL='$template' TTL='$ttl' EXP='$exp'" -dns_rec="$dns_rec SOA='$soa' SUSPENDED='no' DATE='$V_DATE'" +dns_rec="$dns_rec SOA='$soa' RECORDS='$records' SUSPENDED='no' DATE='$V_DATE'" echo "$dns_rec" >> $V_USERS/$user/dns.conf chmod 660 $V_USERS/$user/dns.conf @@ -125,6 +127,7 @@ chown root:named $conf # Increasing domain value increase_user_value "$user" '$U_DNS_DOMAINS' +increase_user_value "$user" '$U_DNS_RECORDS' "$records" # Adding task to the vesta pipe restart_schedule 'dns' diff --git a/bin/v_add_dns_domain_record b/bin/v_add_dns_domain_record index 75f21edf0..4d454830c 100755 --- a/bin/v_add_dns_domain_record +++ b/bin/v_add_dns_domain_record @@ -91,6 +91,13 @@ update_domain_zone # Vesta # #----------------------------------------------------------# +# Updating dns domain values +records="$(wc -l $V_USERS/$user/dns/$domain)" +update_dns_domain_value '$RECORDS' "$records" + +# Updating user counters +increase_user_value "$user" '$U_DNS_RECORDS' + # Adding task to the vesta pipe restart_schedule 'dns' diff --git a/bin/v_rebuild_dns_domains b/bin/v_rebuild_dns_domains index c94007d72..d0bfa7398 100755 --- a/bin/v_rebuild_dns_domains +++ b/bin/v_rebuild_dns_domains @@ -44,6 +44,9 @@ is_user_suspended # Action # #----------------------------------------------------------# +user_records=0 +suspended_dns=0 + # Checking dns folder if [ ! -d "$V_USERS/$user/dns" ]; then rm -f $V_USERS/$user/dns @@ -117,6 +120,7 @@ for domain in $domains; do if [ ! -z "$rm_string" ]; then sed -i "$rm_string d" $nconf fi + suspended_dns=$((suspended_dns + 1)) else if [ -z "$(grep /$domain.db $nconf)" ]; then named="zone \"$domain_idn\" {type master; file" @@ -124,6 +128,9 @@ for domain in $domains; do echo "$named" >> /etc/named.conf fi fi + records=$(wc -l $V_USERS/$user/dns/$domain | cut -f 1 -d ' ') + user_records=$((user_records + records)) + update_dns_domain_value '$RECORDS' "$records" done @@ -131,6 +138,10 @@ done # Vesta # #----------------------------------------------------------# +# Updating counters +update_user_value "$user" '$U_DNS_RECORDS' "$user_records" +update_user_value "$user" '$SUSPENDED_DNS' "$suspended_dns" + # Adding task to the vesta pipe restart_schedule 'dns' diff --git a/bin/v_suspend_dns_domain b/bin/v_suspend_dns_domain index 058fe8de9..192e022ac 100755 --- a/bin/v_suspend_dns_domain +++ b/bin/v_suspend_dns_domain @@ -63,6 +63,7 @@ fi # Adding suspend in config update_dns_domain_value '$SUSPENDED' 'yes' +increase_user_value "$user" '$SUSPENDED_DNS' # Adding task to the vesta pipe restart_schedule 'dns' diff --git a/bin/v_suspend_dns_domains b/bin/v_suspend_dns_domains index e4353e0f4..3d3b4b0af 100755 --- a/bin/v_suspend_dns_domains +++ b/bin/v_suspend_dns_domains @@ -45,23 +45,12 @@ conf="$V_USERS/$user/dns.conf" # Defining fileds to select field='$DOMAIN' - -# Defining search string search_string="SUSPENDED='no'" - -# Parsing unsuspeneded domains domains=$(dom_clear_search) # Starting suspend loop for domain in $domains; do - # Defining named config - conf="/etc/named.conf" - rm_string=$(grep -n /etc/namedb/$domain.db $conf|cut -d : -f 1) - if [ ! -z "$rm_string" ]; then - sed -i "$rm_string d" $conf - fi - # Adding suspend in config - update_dns_domain_value '$SUSPENDED' 'yes' + $V_BIN/v_suspend_web_domain "$user" "$domain" "$url" done diff --git a/bin/v_unsuspend_dns_domain b/bin/v_unsuspend_dns_domain index 919e40740..0cf82d71a 100755 --- a/bin/v_unsuspend_dns_domain +++ b/bin/v_unsuspend_dns_domain @@ -61,6 +61,7 @@ echo "$nmd_rec" >> $conf # Unsuspending domain in config update_dns_domain_value '$SUSPENDED' 'no' +decrease_user_value "$user" '$SUSPENDED_DNS' # Adding task to the vesta pipe restart_schedule 'dns'