|
|
@@ -49,36 +49,43 @@ is_web_domain_new() {
|
|
|
|
|
|
# Web alias existence check
|
|
|
is_web_alias_new() {
|
|
|
- web_alias=$(grep -wH "$1" $HESTIA/data/users/*/web.conf)
|
|
|
- if [ ! -z "$web_alias" ]; then
|
|
|
- a1=$(echo "$web_alias" |grep -F "'$1'" |cut -f 7 -d /)
|
|
|
- if [ ! -z "$a1" ] && [ "$2" == "web" ]; then
|
|
|
- check_result $E_EXISTS "Web alias $1 exists"
|
|
|
- fi
|
|
|
- if [ ! -z "$a1" ] && [ "$a1" != "$user" ]; then
|
|
|
- check_result $E_EXISTS "Web alias $1 exists"
|
|
|
- fi
|
|
|
- a2=$(echo "$web_alias" |grep -F "'$1," |cut -f 7 -d /)
|
|
|
- if [ ! -z "$a2" ] && [ "$2" == "web" ]; then
|
|
|
- check_result $E_EXISTS "Web alias $1 exists"
|
|
|
- fi
|
|
|
- if [ ! -z "$a2" ] && [ "$a2" != "$user" ]; then
|
|
|
- check_result $E_EXISTS "Web alias $1 exists"
|
|
|
- fi
|
|
|
- a3=$(echo "$web_alias" |grep -F ",$1," |cut -f 7 -d /)
|
|
|
- if [ ! -z "$a3" ] && [ "$2" == "web" ]; then
|
|
|
- check_result $E_EXISTS "Web alias $1 exists"
|
|
|
- fi
|
|
|
- if [ ! -z "$a3" ] && [ "$a3" != "$user" ]; then
|
|
|
- check_result $E_EXISTS "Web alias $1 exists"
|
|
|
- fi
|
|
|
- a4=$(echo "$web_alias" |grep -F ",$1'" |cut -f 7 -d /)
|
|
|
- if [ ! -z "$a4" ] && [ "$2" == "web" ]; then
|
|
|
- check_result $E_EXISTS "Web alias $1 exists"
|
|
|
- fi
|
|
|
- if [ ! -z "$a4" ] && [ "$a4" != "$user" ]; then
|
|
|
- check_result $E_EXISTS "Web alias $1 exists"
|
|
|
+ grep -wH "$1" $HESTIA/data/users/*/web.conf | while read -r line ; do
|
|
|
+ user=$(echo $line |cut -f 7 -d /)
|
|
|
+ string=$(echo $line |cut -f 2- -d ':')
|
|
|
+ parse_object_kv_list $string
|
|
|
+ if [ ! -z "$ALIAS" ]; then
|
|
|
+ a1=$(echo "'$ALIAS'" |grep -F "'$1'");
|
|
|
+ if [ ! -z "$a1" ] && [ "$2" == "web" ]; then
|
|
|
+ return $E_EXISTS
|
|
|
+ fi
|
|
|
+ if [ ! -z "$a1" ] && [ "$user" != "$user" ]; then
|
|
|
+ return $E_EXISTS
|
|
|
+ fi
|
|
|
+ a2=$(echo "'$ALIAS'" |grep -F "'$1,")
|
|
|
+ if [ ! -z "$a2" ] && [ "$2" == "web" ]; then
|
|
|
+ return $E_EXISTS
|
|
|
+ fi
|
|
|
+ if [ ! -z "$a2" ] && [ "$user" != "$user" ]; then
|
|
|
+ return $E_EXISTS
|
|
|
+ fi
|
|
|
+ a3=$(echo "'$ALIAS'" |grep -F ",$1," )
|
|
|
+ if [ ! -z "$a3" ] && [ "$2" == "web" ]; then
|
|
|
+ return $E_EXISTS
|
|
|
+ fi
|
|
|
+ if [ ! -z "$a3" ] && [ "$user" != "$user" ]; then
|
|
|
+ return $E_EXISTS
|
|
|
+ fi
|
|
|
+ a4=$(echo "'$ALIAS'" |grep -F ",$1'")
|
|
|
+ if [ ! -z "$a4" ] && [ "$2" == "web" ]; then
|
|
|
+ return $E_EXISTS
|
|
|
+ fi
|
|
|
+ if [ ! -z "$a4" ] && [ "$user" != "$user" ]; then
|
|
|
+ return $E_EXISTS
|
|
|
+ fi
|
|
|
fi
|
|
|
+ done
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ check_result $E_EXISTS "Web alias $1 exists"
|
|
|
fi
|
|
|
}
|
|
|
|