Serghey Rodin 14 лет назад
Родитель
Сommit
0757a13493

+ 4 - 1
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'

+ 7 - 0
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'
 

+ 11 - 0
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'
 

+ 1 - 0
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'

+ 1 - 12
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
 
 

+ 1 - 0
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'