Skip to content

Commit 7884d50

Browse files
author
Kristan Kenney
authored
Merge pull request hestiacp#1780 from jaapmarcus/fix/1767-web-alias-limit-broken
Fix Limit issue Alias
2 parents eed784b + a42d9a2 commit 7884d50

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

bin/v-add-web-domain

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ check_args '2' "$#" 'USER DOMAIN [IP] [RESTART] [ALIASES] [PROXY_EXTENSIONS]'
5252
is_format_valid 'user' 'domain' 'aliases' 'ip' 'proxy_ext'
5353
is_object_valid 'user' 'USER' "$user"
5454
is_object_unsuspended 'user' 'USER' "$user"
55-
is_package_full 'WEB_DOMAINS' 'WEB_ALIASES'
55+
is_package_full 'WEB_DOMAINS'
56+
57+
if [ "$aliases" != "none" ]; then
58+
ALIAS=$aliases
59+
is_package_full 'WEB_ALIASES'
60+
fi
5661

5762
if [ "$($BIN/v-list-web-domain $user $domain_utf plain |cut -f 1) " != "$domain" ]; then
5863
is_domain_new 'web' "$domain_utf,$aliases"

bin/v-add-web-domain-alias

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ is_object_unsuspended 'user' 'USER' "$user"
5353
is_object_valid 'web' 'DOMAIN' "$domain"
5454
is_object_unsuspended 'web' 'DOMAIN' "$domain"
5555
is_domain_new 'web' "$aliases"
56-
is_package_full 'WEB_ALIASES'
57-
5856
is_base_domain_owner "$aliases"
5957

6058
# Perform verification if read-only mode is enabled
@@ -65,7 +63,6 @@ check_hestia_demo_mode
6563
# Action #
6664
#----------------------------------------------------------#
6765

68-
# Parsing domain values
6966
get_domain_values 'web'
7067

7168
# Preparing domain values for the template substitution
@@ -77,6 +74,8 @@ else
7774
fi
7875
prepare_web_domain_values
7976

77+
is_package_full 'WEB_ALIASES'
78+
8079
# Rebuilding vhost
8180
del_web_config "$WEB_SYSTEM" "$TPL.tpl"
8281
add_web_config "$WEB_SYSTEM" "$TPL.tpl"

func/main.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,15 @@ is_package_full() {
179179
esac
180180
used=$(echo "$used"| cut -f 1 -d \ )
181181
limit=$(grep "^$1=" $USER_DATA/user.conf |cut -f 2 -d \')
182-
if [ "$limit" != 'unlimited' ] && [[ "$used" -ge "$limit" ]]; then
183-
check_result $E_LIMIT "$1 limit is reached :: upgrade user package"
182+
if [ "$1" = WEB_ALIASES ]; then
183+
# Used is always calculated with the new alias added
184+
if [ "$limit" != 'unlimited' ] && [[ "$used" -gt "$limit" ]]; then
185+
check_result $E_LIMIT "$1 limit is reached :: upgrade user package"
186+
fi
187+
else
188+
if [ "$limit" != 'unlimited' ] && [[ "$used" -ge "$limit" ]]; then
189+
check_result $E_LIMIT "$1 limit is reached :: upgrade user package"
190+
fi
184191
fi
185192
}
186193

0 commit comments

Comments
 (0)