mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 02:28:03 -07:00
replaced underscore with dash in api syscalls
This commit is contained in:
parent
7ed705cee7
commit
b6b7eacadb
283 changed files with 438 additions and 412 deletions
110
bin/v-change-web-domain-tpl
Executable file
110
bin/v-change-web-domain-tpl
Executable file
|
@ -0,0 +1,110 @@
|
|||
#!/bin/bash
|
||||
# info: change web domain template
|
||||
# options: user domain template [restart]
|
||||
#
|
||||
# The function changes template of httpd.conf configuration file. The content
|
||||
# of webdomain directories remains untouched.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user=$1
|
||||
domain=$(idn -t --quiet -u "$2" )
|
||||
domain_idn=$(idn -t --quiet -a "$domain")
|
||||
template=$3
|
||||
restart=$4
|
||||
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/main.sh
|
||||
source $VESTA/func/domain.sh
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '3' "$#" 'user domain template [restart]'
|
||||
validate_format 'user' 'domain' 'template'
|
||||
is_system_enabled "$WEB_SYSTEM"
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
is_object_valid 'web' 'DOMAIN' "$domain"
|
||||
is_object_unsuspended 'web' 'DOMAIN' "$domain"
|
||||
is_apache_template_valid
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Parsing domain values
|
||||
get_domain_values 'web'
|
||||
|
||||
# Deleting domain
|
||||
tpl_file="$WEBTPL/apache_$TPL.tpl"
|
||||
old_tpl=$TPL
|
||||
conf="$HOMEDIR/$user/conf/web/httpd.conf"
|
||||
del_web_config
|
||||
|
||||
# Deleting ssl vhost
|
||||
if [ "$SSL" = 'yes' ]; then
|
||||
tpl_file="$WEBTPL/apache_$TPL.stpl"
|
||||
conf="$HOMEDIR/$user/conf/web/shttpd.conf"
|
||||
del_web_config
|
||||
fi
|
||||
|
||||
# Defining variables for new vhost config
|
||||
upd_web_domain_values
|
||||
tpl_file="$WEBTPL/apache_$template.tpl"
|
||||
|
||||
# Checking error log
|
||||
if [ "$ELOG" = 'no' ]; then
|
||||
elog='#'
|
||||
else
|
||||
elog=''
|
||||
fi
|
||||
|
||||
# Adding domain to the httpd.conf
|
||||
add_web_config
|
||||
|
||||
# Running template trigger
|
||||
if [ -x $WEBTPL/apache_$template.sh ]; then
|
||||
$WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $docroot
|
||||
fi
|
||||
|
||||
# Checking ssl
|
||||
if [ "$SSL" = 'yes' ]; then
|
||||
conf="$HOMEDIR/$user/conf/web/shttpd.conf"
|
||||
tpl_file="$WEBTPL/apache_$template.stpl"
|
||||
|
||||
add_web_config
|
||||
|
||||
# Running template trigger
|
||||
if [ -x $WEBTPL/apache_$template.sh ]; then
|
||||
$WEBTPL/apache_$template.sh \
|
||||
"$user" "$domain" "$ip" "$HOMEDIR" "$sdocroot"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Changing tpl in config
|
||||
update_object_value 'web' 'DOMAIN' "$domain" '$TPL' "$template"
|
||||
|
||||
# Restart web
|
||||
if [ "$restart" != 'no' ]; then
|
||||
$BIN/v-restart-web "$EVENT"
|
||||
fi
|
||||
|
||||
# Logging
|
||||
log_history "changed web domain template for $domain to $template" '' 'admin'
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue