Skip to content

Commit 96edcb5

Browse files
authored
Merge pull request hestiacp#1240 from hestiacp/staging/fixes
Staging/fixes
2 parents 853fcb2 + 53ce337 commit 96edcb5

File tree

15 files changed

+168
-14
lines changed

15 files changed

+168
-14
lines changed

bin/v-add-backup-host

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
type=$1
1414
host=$2
1515
user=$3
16-
password=$4; HIDE=4
16+
raw_password=$4; HIDE=4
17+
password=$(perl -e 'print quotemeta shift(@ARGV)' "${raw_password}")
1718
path=${5-/backup}
1819
port=$6
1920

bin/v-add-web-domain-backend

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,13 @@ cat $WEBTPL/$WEB_BACKEND/$template.tpl |\
6666
-e "s|%backend%|$backend_type|g"\
6767
-e "s|%backend_version%|$backend_version|g" > $pool/$backend_type.conf
6868

69+
6970
# Set correct document root path
7071
if [ ! -z "$CUSTOM_DOCROOT" ]; then
7172
docroot="$CUSTOM_DOCROOT"
73+
if [ ! -z "$CUSTOM_PHPROOT" ]; then
74+
docroot="$CUSTOM_PHPROOT"
75+
fi
7276
sed -i "s|/home\/$user\/web\/$domain\/public_html|$docroot|g" $pool/$backend_type.conf
7377
else
7478
docroot="$HOMEDIR/$user/web/$domain/public_html/"

bin/v-change-web-domain-docroot

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
# info: Changes the document root for an existing web domain
33

4-
# options: USER DOMAIN TARGET_DOMAIN [DIRECTORY]
4+
# options: USER DOMAIN TARGET_DOMAIN [DIRECTORY] [PHP]
55
# example usage:
66
# add custom docroot: v-change-web-domain-docroot admin domain.tld otherdomain.tld
77
# points domain.tld to otherdomain.tld's document root.
@@ -25,6 +25,7 @@ domain=$2
2525
# so they are correctly passed through to domain.sh
2626
export target_domain=$3
2727
export target_directory=$4
28+
export php=$5
2829

2930
# Includes
3031
source $HESTIA/func/main.sh
@@ -66,13 +67,15 @@ check_hestia_demo_mode
6667
# Unset existing custom document root path
6768
if [ ! -z "$CUSTOM_DOCROOT" ]; then
6869
update_object_value 'web' 'DOMAIN' "$domain" '$CUSTOM_DOCROOT' ""
70+
update_object_value 'web' 'DOMAIN' "$domain" '$CUSTOM_PHPROOT' ""
6971
fi
7072

7173
# If target domain value is 'default', remove the custom document root
7274
# value and rebuild web domain to restore default configuration.
7375
# Otherwise, set target document root path accordingly based on passed values.
7476
if [ "$target_domain" = "default" ]; then
7577
update_object_value 'web' 'DOMAIN' "$domain" '$CUSTOM_DOCROOT' ""
78+
update_object_value 'web' 'DOMAIN' "$domain" '$CUSTOM_PHPROOT' ""
7679
else
7780
# Check for existence of specified directory under target domain's public_html folder
7881
if [ ! -z "$target_directory" ]; then
@@ -81,12 +84,24 @@ else
8184
exit 1
8285
else
8386
CUSTOM_DOCROOT="$HOMEDIR/$user/web/$target_domain/public_html/$target_directory/"
87+
if [ ! -z "$php" ]; then
88+
custom_phproot="$HOMEDIR/$user/web/$target_domain/public_html/"
89+
else
90+
custom_phproot="$HOMEDIR/$user/web/$target_domain/public_html/$target_directory/"
91+
fi
8492
fi
8593
else
8694
CUSTOM_DOCROOT="$HOMEDIR/$user/web/$target_domain/public_html/"
95+
custom_phproot="$HOMEDIR/$user/web/$target_domain/public_html/"
8796
fi
97+
8898
add_object_key 'web' 'DOMAIN' "$domain" 'CUSTOM_DOCROOT' 'IP6'
99+
add_object_key 'web' 'DOMAIN' "$domain" 'CUSTOM_PHPROOT' 'IP6'
100+
89101
update_object_value 'web' 'DOMAIN' "$domain" '$CUSTOM_DOCROOT' "$CUSTOM_DOCROOT"
102+
# CUSTOM_PHPROOT got overwriten by default
103+
CUSTOM_PHPROOT=$custom_phproot
104+
update_object_value 'web' 'DOMAIN' "$domain" '$CUSTOM_PHPROOT' "$CUSTOM_PHPROOT"
90105
fi
91106

92107
#----------------------------------------------------------#

bin/v-list-sys-config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ json_list() {
5757
"WEBMAIL_ALIAS": "'$WEBMAIL_ALIAS'",
5858
"DB_PMA_ALIAS": "'$DB_PMA_ALIAS'",
5959
"DB_PGA_ALIAS": "'$DB_PGA_ALIAS'",
60+
"LOGIN_STYLE": "'$LOGIN_STYLE'",
6061
"SOFTACULOUS": "'$SOFTACULOUS'"
6162
}
6263
}'

install/hst-install-debian.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,9 @@ echo "BACKUP_MODE='zstd'" >> $HESTIA/conf/hestia.conf
10801080
# Language
10811081
echo "LANGUAGE='$lang'" >> $HESTIA/conf/hestia.conf
10821082

1083+
# Login in screen
1084+
echo "LOGIN_STYLE='default" >> $HESTIA/conf/hestia.conf
1085+
10831086
# Version & Release Branch
10841087
echo "VERSION='${HESTIA_INSTALL_VER}'" >> $HESTIA/conf/hestia.conf
10851088
echo "RELEASE_BRANCH='release'" >> $HESTIA/conf/hestia.conf

install/hst-install-ubuntu.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,9 @@ echo "BACKUP_MODE='zstd'" >> $HESTIA/conf/hestia.conf
11181118
# Language
11191119
echo "LANGUAGE='$lang'" >> $HESTIA/conf/hestia.conf
11201120

1121+
# Login in screen
1122+
echo "LOGIN_STYLE='default" >> $HESTIA/conf/hestia.conf
1123+
11211124
# Version & Release Branch
11221125
echo "VERSION='${HESTIA_INSTALL_VER}'" >> $HESTIA/conf/hestia.conf
11231126
echo "RELEASE_BRANCH='release'" >> $HESTIA/conf/hestia.conf

install/upgrade/versions/1.3.0.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ fi
5656

5757
# Change backup mode to zstd.
5858
echo "[ * ] Enable new backup compression zstd as default."
59-
$BIN/v-change-sys-config-value "BACKUP_MODE" "zstd"
59+
$BIN/v-change-sys-config-value "BACKUP_MODE" "zstd"
60+
61+
# Set var LOGIN_STYLE hestia.conf
62+
echo "[ * ] Set var LOGIN_STYLE hestia.conf"
63+
$BIN/v-change-sys-config-value "LOGIN_STYLE" "default"

test/test.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ load 'test_helper/bats-file/load'
66

77

88
function random() {
9-
head /dev/urandom | tr -dc A-Za-z0-9 | head -c$1
9+
head /dev/urandom | tr -dc 0-9 | head -c$1
1010
}
1111

1212
function setup() {

test/test_actions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ V_TEST="$HESTIA/test"
77

88
# Define functions
99
random() {
10-
head /dev/urandom | tr -dc A-Za-z0-9 | head -c$1
10+
head /dev/urandom | tr -dc 0-9 | head -c$1
1111
}
1212

1313
echo_result() {

web/add/web/index.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,15 @@
238238

239239
}else{
240240
$v_custom_doc_domain = escapeshellarg($_POST['v-custom-doc-domain']);
241+
if(substr($_POST['v-custom-doc-folder'], -1) == '/'){
242+
$v_custom_doc_folder = escapeshellarg(substr($_POST['v-custom-doc-folder'],0,-1));
243+
}else{
244+
$v_custom_doc_folder = escapeshellarg($_POST['v-custom-doc-folder']);
245+
}
241246
$v_custom_doc_folder = escapeshellarg($_POST['v-custom-doc-folder']);
242247
$v_domain = escapeshellarg(trim($_POST['v_domain']));
243248

244-
exec(HESTIA_CMD."v-change-web-domain-docroot ".$user." ".$v_domain." ".$v_custom_doc_domain." ".$v_custom_doc_folder, $output, $return_var);
249+
exec(HESTIA_CMD."v-change-web-domain-docroot ".$user." ".$v_domain." ".$v_custom_doc_domain." ".$v_custom_doc_folder." yes", $output, $return_var);
245250
check_return_code($return_var,$output);
246251
unset($output);
247252
$v_custom_doc_root = 1;

0 commit comments

Comments
 (0)