Added passeneg manager. Part 8
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# example: v-unpdate-web-domain admin acme.com test_template
|
||||
#
|
||||
# This function of updating of the domain's configs.
|
||||
# This function of updating of the domain's configs and set template or notemplate if just update of configs
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variables & Functions #
|
||||
@@ -38,7 +38,7 @@ format_domain_idn
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '2' "$#" 'USER DOMAIN [RESTART]'
|
||||
check_args '3' "$#" 'USER DOMAIN TEMPLATE [RESTART]'
|
||||
is_format_valid 'user' 'domain'
|
||||
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
@@ -50,7 +50,7 @@ check_hestia_demo_mode
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
##TODO
|
||||
|
||||
# Parsing domain values
|
||||
get_domain_values 'web'
|
||||
local_ip=$(get_real_ip $IP)
|
||||
@@ -60,37 +60,7 @@ prepare_web_domain_values
|
||||
|
||||
if [ "$template" != "notemplate" ]; then
|
||||
update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' "$template"
|
||||
fi
|
||||
|
||||
echo "TPL=$TPL"
|
||||
echo "PROXY=$PROXY.tpl"
|
||||
echo "USER_DATA=$USER_DATA"
|
||||
exit 0
|
||||
|
||||
# Rebuilding vhost
|
||||
del_web_config "$WEB_SYSTEM" "$TPL.tpl"
|
||||
add_web_config "$WEB_SYSTEM" "$TPL.tpl"
|
||||
if [ "$SSL" = 'yes' ]; then
|
||||
del_web_config "$WEB_SYSTEM" "$TPL.stpl"
|
||||
add_web_config "$WEB_SYSTEM" "$TPL.stpl"
|
||||
fi
|
||||
|
||||
# Rebuilding proxy configuration
|
||||
if [ -n "$PROXY_SYSTEM" ] && [ -n "$PROXY" ]; then
|
||||
del_web_config "$PROXY_SYSTEM" "$PROXY.tpl"
|
||||
add_web_config "$PROXY_SYSTEM" "$PROXY.tpl"
|
||||
if [ "$SSL" = 'yes' ]; then
|
||||
del_web_config "$PROXY_SYSTEM" "$PROXY.stpl"
|
||||
add_web_config "$PROXY_SYSTEM" "$PROXY.stpl"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Rebuilding backend configuration
|
||||
if [ -n "$WEB_BACKEND" ]; then
|
||||
prepare_web_backend "$BACKEND"
|
||||
delete_web_backend
|
||||
template=$(get_object_value 'web' 'DOMAIN' "$domain" '$BACKEND')
|
||||
$BIN/v-add-web-domain-backend $user $domain $template $restart
|
||||
$BIN/v-log-action "system" "Info" "Web" "Set new template=$template for $PROXY (User: $user, Domain: $domain)."
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
||||
@@ -285,14 +285,15 @@ add_web_config() {
|
||||
PASS_TPL=""
|
||||
#Passenger generator
|
||||
if [ -e /usr/local/hestia/bin/v-ext-modules ]; then
|
||||
res=$(/usr/local/hestia/bin/v-ext-modules state passenger_manager | tail -n 1)
|
||||
res=$(/usr/local/hestia/bin/v-ext-modules state passenger_manager csv | tail -n 1 | /usr/bin/xargs | cut -d"," -f6 )
|
||||
if [ -n "$res" ]; then
|
||||
enabled=$(echo "$res" | grep enabled)
|
||||
if [ -n "$enabled" ]; then
|
||||
RUBY_RES=$(/usr/local/hestia/bin/v-ext-modules-run passenger_manager get_user_ruby "$domain" | tail -n1)
|
||||
RUBY_RES=$(/usr/local/hestia/bin/v-ext-modules-run passenger_manager get_user_ruby "$domain" | tail -n1 | /usr/bin/xargs)
|
||||
if [ -n "$RUBY_RES" ]; then
|
||||
pass_tpl_dir=$(v-ext-modules-run passenger_manager get_tpl_path | tail -n1)
|
||||
pass_tpl_dir=$(/usr/local/hestia/bin/v-ext-modules-run passenger_manager get_tpl_path | tail -n1 | /usr/bin/xargs)
|
||||
if [ -n "$pass_tpl_dir" ]; then
|
||||
pass_tpl_dir=${pass_tpl_dir%/}
|
||||
PASS_TPL="$pass_tpl_dir"
|
||||
if [[ "$TPLNM" =~ stpl$ ]]; then
|
||||
TPLNM="passenger.stpl"
|
||||
|
||||
@@ -224,7 +224,7 @@ if (!empty($_POST["save"])) {
|
||||
// Save ruby setting for domain
|
||||
if (!empty($_POST["v_passenger_enabled"])){
|
||||
$v_ruby_path = $_POST["v_ruby_path"];
|
||||
if ($v_ruby_path != $domain_ruby["RUBY"]){
|
||||
if ($v_ruby_path != $domain_ruby[0]["RUBY"]){
|
||||
exec(HESTIA_CMD . "v-ext-modules-run passenger_manager set_user_ruby " . quoteshellarg($v_domain) . " ". quoteshellarg($v_ruby_path), $output, $return_var);
|
||||
check_return_code($return_var, $output);
|
||||
$restart_web = "yes";
|
||||
@@ -234,7 +234,7 @@ if (!empty($_POST["save"])) {
|
||||
}
|
||||
} else {
|
||||
if ($passenger_state == "enabled"){
|
||||
if ($domain_ruby["RUBY"] != ""){
|
||||
if ($domain_ruby[0]["RUBY"] != ""){
|
||||
exec(HESTIA_CMD . "v-ext-modules-run passenger_manager disable_user " . quoteshellarg($v_domain), $output, $return_var);
|
||||
check_return_code($return_var, $output);
|
||||
$restart_web = "yes";
|
||||
@@ -246,7 +246,18 @@ if (!empty($_POST["save"])) {
|
||||
}
|
||||
|
||||
if ($changed_ruby == true){
|
||||
|
||||
exec(HESTIA_CMD . "v-update-web-domain " .
|
||||
$user .
|
||||
" " .
|
||||
quoteshellarg($v_domain) .
|
||||
" " .
|
||||
"passenger",
|
||||
$output, $return_var);
|
||||
check_return_code($return_var, $output);
|
||||
$restart_web = "yes";
|
||||
$restart_proxy = "yes";
|
||||
unset($output);
|
||||
$changed_ruby = true;
|
||||
}
|
||||
|
||||
if (!empty($_POST["v_ip"])) {
|
||||
|
||||
Reference in New Issue
Block a user