mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-07-30 19:40:54 -07:00
optimized domain functions
This commit is contained in:
parent
0757a13493
commit
242b5981f4
48 changed files with 154 additions and 230 deletions
|
@ -51,7 +51,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
# Checking domain is active
|
||||
is_domain_suspended 'dns'
|
||||
|
@ -93,7 +93,7 @@ update_domain_zone
|
|||
|
||||
# Updating dns domain values
|
||||
records="$(wc -l $V_USERS/$user/dns/$domain)"
|
||||
update_dns_domain_value '$RECORDS' "$records"
|
||||
update_domain_value 'dns' '$RECORDS' "$records"
|
||||
|
||||
# Updating user counters
|
||||
increase_user_value "$user" '$U_DNS_RECORDS'
|
||||
|
|
|
@ -46,7 +46,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
@ -71,7 +71,7 @@ is_package_full 'web_alias'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Parsing domain values
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
|
||||
conf="$V_HOME/$user/conf/web/httpd.conf"
|
||||
|
||||
|
@ -118,7 +118,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding new alias
|
||||
update_web_domain_value '$ALIAS' "$ALIAS"
|
||||
update_domain_value 'web' '$ALIAS' "$ALIAS"
|
||||
|
||||
# Update counters
|
||||
increase_user_value "$user" '$U_WEB_ALIASES'
|
||||
|
|
|
@ -44,13 +44,13 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# 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
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
|
||||
conf="$V_HOME/$user/conf/web/httpd.conf"
|
||||
CGI='yes'
|
||||
|
@ -84,7 +84,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding elog in config
|
||||
update_web_domain_value '$CGI' 'yes'
|
||||
update_domain_value 'web' '$CGI' 'yes'
|
||||
|
||||
# Adding task to the vesta pipe
|
||||
restart_schedule 'web'
|
||||
|
|
|
@ -42,13 +42,13 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# 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
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
|
||||
conf="$V_HOME/$user/conf/web/httpd.conf"
|
||||
ELOG='yes'
|
||||
|
@ -98,7 +98,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding elog in config
|
||||
update_web_domain_value '$ELOG' 'yes'
|
||||
update_domain_value 'web' '$ELOG' 'yes'
|
||||
|
||||
# Adding task to the vesta pipe
|
||||
restart_schedule 'web'
|
||||
|
|
|
@ -46,13 +46,13 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# Check nginx is not added
|
||||
is_web_domain_key_empty '$NGINX'
|
||||
is_domain_key_empty 'web' '$NGINX'
|
||||
|
||||
# Checking template
|
||||
is_template_valid "proxy"
|
||||
|
@ -63,7 +63,7 @@ is_template_valid "proxy"
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Defining domain parameters
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
NGINX="$template"
|
||||
NGINX_EXT="$extentions"
|
||||
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
|
||||
|
@ -108,8 +108,8 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# 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
|
||||
restart_schedule 'web'
|
||||
|
|
|
@ -49,7 +49,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
@ -58,7 +58,7 @@ is_domain_suspended 'web'
|
|||
is_package_full 'web_ssl'
|
||||
|
||||
# Check ssl is not added
|
||||
is_web_domain_key_empty '$SSL'
|
||||
is_domain_key_empty 'web' '$SSL'
|
||||
|
||||
# Checking ssl certificate
|
||||
is_web_domain_cert_valid
|
||||
|
@ -79,7 +79,7 @@ fi
|
|||
chmod 660 $V_USERS/$user/ssl/$domain.*
|
||||
|
||||
# Parsing domain values
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
conf="$V_HOME/$user/conf/web/shttpd.conf"
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.stpl"
|
||||
SSL_HOME="$ssl_home"
|
||||
|
@ -143,8 +143,8 @@ fi
|
|||
increase_user_value "$user" '$U_WEB_SSL'
|
||||
|
||||
# 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
|
||||
log_history "$V_EVENT" "v_delete_web_domain_ssl $user $domain"
|
||||
|
|
|
@ -46,7 +46,7 @@ is_user_valid "$user"
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
@ -55,7 +55,7 @@ is_domain_suspended 'web'
|
|||
is_type_valid 'stat' "$type"
|
||||
|
||||
# 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
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
|
||||
# Preparing domain values for the template substitution
|
||||
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
|
||||
|
||||
# Adding stats in config
|
||||
update_web_domain_value '$STATS' "$type"
|
||||
update_domain_value 'web' '$STATS' "$type"
|
||||
|
||||
# Logging
|
||||
log_history "$V_EVENT" "v_delete_web_domain_stat $user $domain"
|
||||
|
|
|
@ -42,7 +42,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
@ -77,7 +77,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# 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")
|
||||
|
||||
# Checking current users
|
||||
|
@ -92,7 +92,7 @@ else
|
|||
fi
|
||||
|
||||
# Adding stats user in config
|
||||
update_web_domain_value '$STATS_AUTH' "$a_users"
|
||||
update_domain_value 'web' '$STATS_AUTH' "$a_users"
|
||||
|
||||
# Hiding password
|
||||
V_EVENT="$V_DATE $V_SCRIPT $user $domain $auth_user *****"
|
||||
|
|
|
@ -160,7 +160,7 @@ then
|
|||
|
||||
# Defining domain variables
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
|
||||
# Packing data folders
|
||||
cd $V_HOME/$user/web/$domain
|
||||
|
|
|
@ -43,7 +43,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'dns'
|
||||
|
@ -54,10 +54,10 @@ is_domain_suspended 'dns'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Get old expiriation date
|
||||
old_exp=$(get_dns_domain_value '$EXP')
|
||||
old_exp=$(get_domain_value 'dns' '$EXP')
|
||||
|
||||
# Changing exp
|
||||
update_dns_domain_value '$EXP' "$exp"
|
||||
update_domain_value 'dns' '$EXP' "$exp"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
|
|
@ -41,7 +41,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'dns'
|
||||
|
@ -52,10 +52,10 @@ is_domain_suspended 'dns'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Get old ip
|
||||
old_ip=$(get_dns_domain_value '$IP')
|
||||
old_ip=$(get_domain_value 'dns' '$IP')
|
||||
|
||||
# Changing ip
|
||||
update_dns_domain_value '$IP' "$ip"
|
||||
update_domain_value 'dns' '$IP' "$ip"
|
||||
|
||||
# Changing records
|
||||
sed -i "s/$old_ip/$ip/g" $V_USERS/$user/dns/$domain
|
||||
|
|
|
@ -45,7 +45,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'dns'
|
||||
|
|
|
@ -42,7 +42,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'dns'
|
||||
|
@ -53,10 +53,10 @@ is_domain_suspended 'dns'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Get old soa
|
||||
old_soa=$(get_dns_domain_value '$SOA')
|
||||
old_soa=$(get_domain_value 'dns' '$SOA')
|
||||
|
||||
# Changing soa
|
||||
update_dns_domain_value '$SOA' "$soa"
|
||||
update_domain_value 'dns' '$SOA' "$soa"
|
||||
|
||||
# Updating zone
|
||||
update_domain_zone
|
||||
|
|
|
@ -44,7 +44,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'dns'
|
||||
|
@ -58,13 +58,13 @@ is_template_valid 'dns'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# 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')
|
||||
ns2=$(get_user_value '$NS2')
|
||||
|
||||
# Changing tpl
|
||||
update_dns_domain_value '$TPL' "$template"
|
||||
update_domain_value 'dns' '$TPL' "$template"
|
||||
|
||||
cat $V_DNSTPL/$template.tpl |\
|
||||
sed -e "s/%ip%/$ip/g" \
|
||||
|
|
|
@ -42,7 +42,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'dns'
|
||||
|
@ -53,10 +53,10 @@ is_domain_suspended 'dns'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Get old ttl
|
||||
old_ttl=$(get_dns_domain_value '$TTL')
|
||||
old_ttl=$(get_domain_value 'dns' '$TTL')
|
||||
|
||||
# Changing ttl
|
||||
update_dns_domain_value '$TTL' "$ttl"
|
||||
update_domain_value 'dns' '$TTL' "$ttl"
|
||||
|
||||
# Updating zone
|
||||
update_domain_zone
|
||||
|
|
|
@ -44,7 +44,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
@ -58,7 +58,7 @@ is_ip_avalable
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Define variable for replace
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
|
||||
conf="$V_HOME/$user/conf/web/httpd.conf"
|
||||
old=$IP
|
||||
|
@ -98,7 +98,7 @@ increase_ip_value "$new"
|
|||
decrease_ip_value "$old"
|
||||
|
||||
# Adding ip in config
|
||||
update_web_domain_value '$IP' "$new"
|
||||
update_domain_value 'web' '$IP' "$new"
|
||||
|
||||
# Adding task to the vesta pipe
|
||||
restart_schedule 'web'
|
||||
|
|
|
@ -43,13 +43,13 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# Check SSL is added
|
||||
is_web_domain_value_exist '$SSL'
|
||||
is_domain_value_exist 'web' '$SSL'
|
||||
|
||||
# Checking ssl certificate
|
||||
is_web_domain_cert_valid
|
||||
|
|
|
@ -38,13 +38,13 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# 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_web_domain_values
|
||||
get_domain_values 'web'
|
||||
old_ssl_home=$SSL_HOME
|
||||
SSL_HOME=$ssl_home
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.stpl"
|
||||
|
@ -83,7 +83,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# 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
|
||||
restart_schedule 'web'
|
||||
|
|
|
@ -43,7 +43,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
@ -58,7 +58,7 @@ is_template_valid "web"
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Parsing domain values
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
|
||||
# Deleting domain
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
|
||||
|
@ -177,13 +177,13 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Changing tpl in config
|
||||
update_web_domain_value '$TPL' "$template"
|
||||
update_domain_value 'web' '$TPL' "$template"
|
||||
|
||||
# Updating db keys
|
||||
for keys in $(cat $V_WEBTPL/apache_$template.descr|grep -v '#'); do
|
||||
key=$(echo "$keys"| cut -f 1 -d '=' |sed -e "s/^/\$/g")
|
||||
value=$(echo "$keys" |cut -f 2 -d \')
|
||||
update_web_domain_value "$key" "$value"
|
||||
update_domain_value 'web' "$key" "$value"
|
||||
done
|
||||
|
||||
# Adding task to the vesta pipe
|
||||
|
|
|
@ -42,7 +42,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
@ -50,8 +50,8 @@ is_dns_domain_valid
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# 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
|
||||
rm_string=$(grep -n /conf/dns/$domain.db $named_conf |cut -d : -f 1)
|
||||
|
|
|
@ -39,7 +39,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'dns'
|
||||
|
|
|
@ -45,7 +45,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
@ -56,7 +56,7 @@ is_domain_suspended 'web'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Get template name
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
|
||||
conf="$V_HOME/$user/conf/web/httpd.conf"
|
||||
|
||||
|
|
|
@ -44,13 +44,13 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# Checking alias is added
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
check_alias=$(echo ${ALIAS//,/ }|grep -w "$dom_alias")
|
||||
if [ -z "$check_alias" ]; then
|
||||
echo "Error: alias not exist"
|
||||
|
@ -107,7 +107,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Deleting alias
|
||||
update_web_domain_value '$ALIAS' "$ALIAS"
|
||||
update_domain_value 'web' '$ALIAS' "$ALIAS"
|
||||
|
||||
# Update counters
|
||||
decrease_user_value "$user" '$U_WEB_ALIASES'
|
||||
|
|
|
@ -44,20 +44,20 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# Checking cgi is added
|
||||
is_web_domain_value_exist '$CGI'
|
||||
is_domain_value_exist 'web' '$CGI'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
|
||||
conf="$V_HOME/$user/conf/web/httpd.conf"
|
||||
CGI='no'
|
||||
|
@ -83,7 +83,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Deleting cgi in config
|
||||
update_web_domain_value '$CGI' 'no'
|
||||
update_domain_value 'web' '$CGI' 'no'
|
||||
|
||||
# Adding task to the vesta pipe
|
||||
restart_schedule 'web'
|
||||
|
|
|
@ -43,13 +43,13 @@ is_user_valid "$user"
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# 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
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
|
||||
conf="$V_HOME/$user/conf/web/httpd.conf"
|
||||
ELOG='no'
|
||||
|
@ -99,7 +99,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Deleting elog in config
|
||||
update_web_domain_value '$ELOG' 'no'
|
||||
update_domain_value 'web' '$ELOG' 'no'
|
||||
|
||||
# Adding task to the vesta pipe
|
||||
restart_schedule 'web'
|
||||
|
|
|
@ -41,13 +41,13 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# 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
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
|
||||
conf="$V_HOME/$user/conf/nginx.conf"
|
||||
del_web_config
|
||||
|
@ -73,8 +73,8 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# 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
|
||||
conf='/etc/nginx/conf.d/vesta_users.conf'
|
||||
|
|
|
@ -41,13 +41,13 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# 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
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
conf="$V_HOME/$user/conf/web/shttpd.conf"
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.stpl"
|
||||
|
||||
|
@ -81,7 +81,7 @@ chown -R $user:$user $tmpdir
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Deleting ssl in config
|
||||
update_web_domain_value '$SSL' 'no'
|
||||
update_domain_value 'web' '$SSL' 'no'
|
||||
|
||||
# Checking last ssl domain
|
||||
ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web.conf)
|
||||
|
|
|
@ -41,13 +41,13 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# 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
|
||||
type=$(get_web_domain_value '$STATS')
|
||||
type=$(get_domain_value 'web' '$STATS')
|
||||
|
||||
# Defining statistic dir
|
||||
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
|
||||
|
||||
# Deleting stats
|
||||
update_web_domain_value '$STATS' ''
|
||||
update_domain_value 'web' '$STATS' ''
|
||||
|
||||
# Logging
|
||||
log_history "$V_EVENT" "v_add_web_domain_stat $user $doman $type"
|
||||
|
|
|
@ -44,13 +44,13 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# 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
|
||||
if [ ! -z "$auth_user" ]; then
|
||||
# Get current value
|
||||
curr_val=$(get_web_domain_value '$STATS_AUTH')
|
||||
curr_val=$(get_domain_value 'web' '$STATS_AUTH')
|
||||
|
||||
# Deleteting auth_user
|
||||
new_val=$(echo "$curr_val" |\
|
||||
|
@ -101,7 +101,7 @@ else
|
|||
fi
|
||||
|
||||
# Deleting stats auth_user
|
||||
update_web_domain_value '$STATS_AUTH' "$new_val"
|
||||
update_domain_value 'web' '$STATS_AUTH' "$new_val"
|
||||
|
||||
# Logging
|
||||
log_history "$V_EVENT"
|
||||
|
|
|
@ -36,7 +36,7 @@ format_validation 'user' 'domain'
|
|||
is_user_valid
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'dns'
|
||||
|
@ -47,7 +47,7 @@ is_domain_suspended 'dns'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Checking key
|
||||
value=$(get_dns_domain_value "$key")
|
||||
value=$(get_domain_value 'dns' "$key")
|
||||
|
||||
# Printing value
|
||||
echo "$value"
|
||||
|
|
|
@ -41,7 +41,7 @@ is_user_valid
|
|||
is_user_suspended
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
@ -51,7 +51,7 @@ is_domain_suspended 'web'
|
|||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
value=$(get_web_domain_value "$key")
|
||||
value=$(get_domain_value 'web' "$key")
|
||||
echo "$value"
|
||||
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ format_validation 'user' 'domain'
|
|||
is_user_valid
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
|
|
@ -85,7 +85,7 @@ check_args '2' "$#" 'user domain [format]'
|
|||
is_user_valid
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
|
|
@ -56,7 +56,7 @@ check_args '2' "$#" 'user domain [format]'
|
|||
is_user_valid
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
|
|
@ -78,12 +78,12 @@ for domain in $domains; do
|
|||
|
||||
# Defining variables
|
||||
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
|
||||
if [ ! -e "$V_USERS/$user/dns/$domain" ]; then
|
||||
|
@ -130,7 +130,7 @@ for domain in $domains; do
|
|||
fi
|
||||
records=$(wc -l $V_USERS/$user/dns/$domain | cut -f 1 -d ' ')
|
||||
user_records=$((user_records + records))
|
||||
update_dns_domain_value '$RECORDS' "$records"
|
||||
update_domain_value 'dns' '$RECORDS' "$records"
|
||||
done
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ for domain in $(shell_list) ; do
|
|||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
|
||||
# Parsing domain values
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
|
||||
# Preparing domain values for the template substitution
|
||||
upd_web_domain_values
|
||||
|
|
|
@ -38,7 +38,7 @@ is_system_enabled 'dns'
|
|||
is_user_valid
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'dns'
|
||||
|
@ -62,7 +62,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding suspend in config
|
||||
update_dns_domain_value '$SUSPENDED' 'yes'
|
||||
update_domain_value 'dns' '$SUSPENDED' 'yes'
|
||||
increase_user_value "$user" '$SUSPENDED_DNS'
|
||||
|
||||
# Adding task to the vesta pipe
|
||||
|
|
|
@ -43,7 +43,7 @@ is_system_enabled 'web'
|
|||
is_user_valid
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
@ -54,7 +54,7 @@ is_domain_suspended 'web'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Parsing domain values
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
|
||||
conf="$V_HOME/$user/conf/web/httpd.conf"
|
||||
SUSPENDED='yes'
|
||||
|
@ -96,7 +96,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Adding suspend in config
|
||||
update_web_domain_value '$SUSPENDED' 'yes'
|
||||
update_domain_value 'web' '$SUSPENDED' 'yes'
|
||||
increase_user_value "$user" '$SUSPENDED_WEB'
|
||||
|
||||
# Adding task to the vesta pipe
|
||||
|
|
|
@ -38,7 +38,7 @@ is_system_enabled 'dns'
|
|||
is_user_valid
|
||||
|
||||
# Checking domain exist
|
||||
is_dns_domain_valid
|
||||
is_domain_valid 'dns'
|
||||
|
||||
# Check domain is suspened
|
||||
is_domain_unsuspended 'dns'
|
||||
|
@ -60,7 +60,7 @@ echo "$nmd_rec" >> $conf
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Unsuspending domain in config
|
||||
update_dns_domain_value '$SUSPENDED' 'no'
|
||||
update_domain_value 'dns' '$SUSPENDED' 'no'
|
||||
decrease_user_value "$user" '$SUSPENDED_DNS'
|
||||
|
||||
# Adding task to the vesta pipe
|
||||
|
|
|
@ -64,7 +64,7 @@ for domain in $domains; do
|
|||
echo "$rec" >> $conf
|
||||
|
||||
# Unsuspendin in config
|
||||
update_dns_domain_value '$SUSPENDED' 'no'
|
||||
update_domain_value 'dns' '$SUSPENDED' 'no'
|
||||
|
||||
done
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ is_system_enabled 'web'
|
|||
is_user_valid
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Check domain is suspened
|
||||
is_domain_unsuspended 'web'
|
||||
|
@ -49,7 +49,7 @@ is_domain_unsuspended 'web'
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Parsing domain values
|
||||
get_web_domain_values
|
||||
get_domain_values 'web'
|
||||
tpl_file="$V_WEBTPL/apache_$TPL.tpl"
|
||||
conf="$V_HOME/$user/conf/web/httpd.conf"
|
||||
SUSPENDED='no'
|
||||
|
@ -91,7 +91,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Updating suspend keys
|
||||
update_web_domain_value '$SUSPENDED' 'no'
|
||||
update_domain_value 'web' '$SUSPENDED' 'no'
|
||||
decrease_user_value "$user" '$SUSPENDED_WEB'
|
||||
|
||||
# Adding task to the vesta pipe
|
||||
|
|
|
@ -38,7 +38,7 @@ is_system_enabled 'web'
|
|||
is_user_valid
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
@ -62,7 +62,7 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# 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
|
||||
disk_size=$(get_usr_disk)
|
||||
|
|
|
@ -38,20 +38,20 @@ is_system_enabled 'web'
|
|||
is_user_valid
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
||||
# Checking stats enabled
|
||||
is_web_domain_value_exist '$STATS'
|
||||
is_domain_value_exist 'web' '$STATS'
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
stats=$(get_web_domain_value '$STATS')
|
||||
stats=$(get_domain_value 'web' '$STATS')
|
||||
|
||||
# Checking config
|
||||
config="$V_HOME/$user/conf/web/$stats.$domain.conf"
|
||||
|
|
|
@ -38,7 +38,7 @@ is_system_enabled 'web'
|
|||
is_user_valid
|
||||
|
||||
# Checking domain exist
|
||||
is_web_domain_valid
|
||||
is_domain_valid 'web'
|
||||
|
||||
# Checking domain is not suspened
|
||||
is_domain_suspended 'web'
|
||||
|
@ -75,13 +75,13 @@ echo > $log_file
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Parsing old value
|
||||
old_val=$(get_web_domain_value '$U_BANDWIDTH')
|
||||
old_val=$(get_domain_value 'web' '$U_BANDWIDTH')
|
||||
|
||||
# Defining new value
|
||||
bandwidth=$((old_val + mb))
|
||||
|
||||
# Updating bandwidth value in config
|
||||
update_web_domain_value '$U_BANDWIDTH' "$bandwidth"
|
||||
update_domain_value 'web' '$U_BANDWIDTH' "$bandwidth"
|
||||
|
||||
# Logging
|
||||
log_event 'system' "$V_EVENT"
|
||||
|
|
|
@ -60,7 +60,7 @@ for domain in $domains; do
|
|||
fi
|
||||
|
||||
# Updating disk value in config
|
||||
update_web_domain_value '$U_DISK' "$disk_usage"
|
||||
update_domain_value 'web' '$U_DISK' "$disk_usage"
|
||||
done
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ domains=$(dom_clear_search)
|
|||
|
||||
# Starting upd loop
|
||||
for domain in $domains; do
|
||||
stats=$(get_web_domain_value '$STATS')
|
||||
stats=$(get_domain_value 'web' '$STATS')
|
||||
if [ ! -z "$stats" ]; then
|
||||
$V_BIN/v_update_web_domain_stat "$user" "$domain"
|
||||
rv="$?"
|
||||
|
|
|
@ -75,13 +75,13 @@ for domain in $domains; do
|
|||
echo > $log_file
|
||||
|
||||
# Parsing old value
|
||||
old_val=$(get_web_domain_value '$U_BANDWIDTH')
|
||||
old_val=$(get_domain_value 'web' '$U_BANDWIDTH')
|
||||
|
||||
# Defining new value
|
||||
bandwidth=$((old_val + mb))
|
||||
|
||||
# Updating bandwidth value in config
|
||||
update_web_domain_value '$U_BANDWIDTH' "$bandwidth"
|
||||
update_domain_value 'web' '$U_BANDWIDTH' "$bandwidth"
|
||||
|
||||
done
|
||||
|
||||
|
|
118
func/domain.func
118
func/domain.func
|
@ -24,7 +24,6 @@ is_domain_new() {
|
|||
fi
|
||||
return $E_EXISTS
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
is_domain_owner() {
|
||||
|
@ -80,21 +79,9 @@ is_web_domain_free() {
|
|||
fi
|
||||
}
|
||||
|
||||
is_dns_domain_valid() {
|
||||
is_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() {
|
||||
# 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
|
||||
if [ -z "$check_domain" ]; then
|
||||
|
@ -315,11 +302,12 @@ replace_web_config() {
|
|||
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
|
||||
string=$( grep "DOMAIN='$domain'" $V_USERS/$user/web.conf )
|
||||
string=$( grep "DOMAIN='$domain'" $V_USERS/$user/$domain_type.conf )
|
||||
|
||||
# Parsing key=value
|
||||
eval $string
|
||||
|
@ -331,36 +319,21 @@ get_web_domain_value() {
|
|||
echo "$value"
|
||||
}
|
||||
|
||||
get_web_domain_values() {
|
||||
get_domain_values() {
|
||||
# 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
|
||||
eval $line
|
||||
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
|
||||
conf="$V_USERS/$user/web.conf"
|
||||
conf="$V_USERS/$user/$domain_type.conf"
|
||||
|
||||
# Parsing conf
|
||||
domain_str=$(grep -n "DOMAIN='$domain'" $conf)
|
||||
|
@ -384,40 +357,12 @@ update_web_domain_value() {
|
|||
$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
|
||||
string=$( grep "DOMAIN='$domain'" $V_USERS/$user/web.conf )
|
||||
string=$( grep "DOMAIN='$domain'" $V_USERS/$user/$domain_type.conf )
|
||||
|
||||
# Parsing key=value
|
||||
eval $string
|
||||
|
@ -483,7 +428,6 @@ is_web_domain_cert_valid() {
|
|||
fi
|
||||
}
|
||||
|
||||
|
||||
is_dns_record_valid() {
|
||||
# Checking record id
|
||||
check_id=$(grep "^ID='$id'" $V_USERS/$user/dns/$domain)
|
||||
|
@ -495,11 +439,12 @@ is_dns_record_valid() {
|
|||
fi
|
||||
}
|
||||
|
||||
is_web_domain_value_exist() {
|
||||
key="$1"
|
||||
is_domain_value_exist() {
|
||||
domain_type="$1"
|
||||
key="$2"
|
||||
|
||||
# Parsing domains
|
||||
string=$( grep "DOMAIN='$domain'" $V_USERS/$user/web.conf )
|
||||
string=$( grep "DOMAIN='$domain'" $V_USERS/$user/$domain_type.conf )
|
||||
|
||||
# Parsing key=value
|
||||
eval $string
|
||||
|
@ -515,27 +460,6 @@ is_web_domain_value_exist() {
|
|||
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() {
|
||||
# Get config borders
|
||||
get_web_config_brds || exit $?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue