mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-19 21:04:06 -07:00
Refactoring stage III
This commit is contained in:
parent
b998c72500
commit
4fa3013716
3 changed files with 100 additions and 207 deletions
|
@ -18,14 +18,14 @@
|
||||||
# Argument defenition
|
# Argument defenition
|
||||||
user=$1
|
user=$1
|
||||||
database="$user"_"$2"
|
database="$user"_"$2"
|
||||||
db_user="$user"_"$3"
|
dbuser="$user"_"$3"
|
||||||
db_password=$4
|
dbpass=$4
|
||||||
type=$5
|
type=$5
|
||||||
host=$6
|
host=$6
|
||||||
encoding=${7-UTF8}
|
encoding=${7-UTF8}
|
||||||
encoding=$(echo "$encoding" |tr '[:lower:]' '[:upper:]')
|
encoding=$(echo "$encoding" |tr '[:lower:]' '[:upper:]')
|
||||||
|
|
||||||
# Importing variables
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
source $VESTA/func/shared.sh
|
source $VESTA/func/shared.sh
|
||||||
source $VESTA/func/db.sh
|
source $VESTA/func/db.sh
|
||||||
|
@ -35,18 +35,18 @@ source $VESTA/func/db.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
check_args '5' "$#" 'user db db_user db_password type [host] [encoding]'
|
check_args '5' "$#" 'user db dbuser dbpass type [host] [encoding]'
|
||||||
validate_format 'user' 'database' 'db_user' 'db_password' 'encoding'
|
validate_format 'user' 'database' 'dbuser' 'dbpass' 'encoding'
|
||||||
is_system_enabled 'DB_SYSTEM'
|
is_system_enabled "$DB_SYSTEM"
|
||||||
is_type_valid "$DB_SYSTEM" "$type"
|
is_type_valid "$DB_SYSTEM" "$type"
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
is_object_unsuspended 'user' 'USER' "$user"
|
is_object_unsuspended 'user' 'USER' "$user"
|
||||||
is_object_free 'db' 'DB' "$database"
|
is_object_free 'db' 'DB' "$database"
|
||||||
get_next_dbhost
|
get_next_dbhost
|
||||||
is_object_valid "$type" 'DBHOST' "$host"
|
is_object_valid "../../../conf/$type" 'HOST' "$host"
|
||||||
|
is_db_encoding_valid
|
||||||
is_package_full 'DATABASES'
|
is_package_full 'DATABASES'
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
@ -67,17 +67,18 @@ increase_dbhost_values
|
||||||
increase_user_value "$user" '$U_DATABASES'
|
increase_user_value "$user" '$U_DATABASES'
|
||||||
|
|
||||||
# Adding db to db conf
|
# Adding db to db conf
|
||||||
v_str="DB='$database' USER='$db_user' HOST='$host' TYPE='$type'"
|
v_str="DB='$database' USER='$dbuser' HOST='$host' TYPE='$type'"
|
||||||
v_str="$v_str CHARSET='$encoding' U_DISK='0' SUSPENDED='no' DATE='$DATE'"
|
v_str="$v_str CHARSET='$encoding' U_DISK='0' SUSPENDED='no' TIME='$TIME'"
|
||||||
|
v_str="$v_str DATE='$DATE'"
|
||||||
echo "$v_str" >> $USER_DATA/db.conf
|
echo "$v_str" >> $USER_DATA/db.conf
|
||||||
chmod 660 $USER_DATA/db.conf
|
chmod 660 $USER_DATA/db.conf
|
||||||
|
|
||||||
# Hiding password
|
# Hiding password
|
||||||
EVENT="$DATE $SCRIPT $user $database $db_user ***** $type $host"
|
EVENT="DATE='$DATE' TIME='$TIME' COMMAND='$SCRIPT'"
|
||||||
EVENT="$EVENT $encoding"
|
EVENT="$EVENT ARGUMENTS='$user $database $dbuser ***** $type $host'"
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log_history "$EVENT" "v_delete_db_base $user $database"
|
log_history "$EVENT"
|
||||||
log_event "$OK" "$EVENT"
|
log_event "$OK" "$EVENT"
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
276
func/db.sh
276
func/db.sh
|
@ -1,42 +1,8 @@
|
||||||
is_db_valid() {
|
# Get database host
|
||||||
config="$USER_DATA/db.conf"
|
|
||||||
check_db=$(grep "DB='$database'" $config)
|
|
||||||
|
|
||||||
# Checking result
|
|
||||||
if [ -z "$check_db" ]; then
|
|
||||||
echo "Error: db not added"
|
|
||||||
log_event 'debug' "$E_NOTEXIST $EVENT"
|
|
||||||
exit $E_NOTEXIST
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
is_db_new() {
|
|
||||||
check_db=$(grep "DB='$database'" $USER_DATA/db.conf)
|
|
||||||
if [ ! -z "$check_db" ]; then
|
|
||||||
echo "Error: db exist"
|
|
||||||
log_event 'debug' "$E_EXISTS $EVENT"
|
|
||||||
exit $E_EXISTS
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Checking database host existance
|
|
||||||
is_db_host_valid() {
|
|
||||||
config="$VESTA/conf/$type.conf"
|
|
||||||
check_db=$(grep "HOST='$host'" $config)
|
|
||||||
|
|
||||||
# Checking result
|
|
||||||
if [ -z "$check_db" ]; then
|
|
||||||
echo "Error: host not added"
|
|
||||||
log_event 'debug' "$E_NOTEXIST $EVENT"
|
|
||||||
exit $E_NOTEXIST
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get_next_dbhost() {
|
get_next_dbhost() {
|
||||||
if [ -z "$host" ]; then
|
if [ -z "$host" ]; then
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
host='NULL_DB_HOST'
|
host='EMPTY_DB_HOST'
|
||||||
config="$VESTA/conf/$type.conf"
|
config="$VESTA/conf/$type.conf"
|
||||||
host_str=$(grep "SUSPENDED='no'" $config)
|
host_str=$(grep "SUSPENDED='no'" $config)
|
||||||
check_row=$(echo "$host_str"|wc -l)
|
check_row=$(echo "$host_str"|wc -l)
|
||||||
|
@ -64,184 +30,135 @@ get_next_dbhost() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
increase_db_value() {
|
# Database encoding validation
|
||||||
# Defining vars
|
is_db_encoding_valid() {
|
||||||
conf="$VESTA/conf/$type.conf"
|
host_str=$(grep "HOST='$host'" $VESTA/conf/$type.conf)
|
||||||
host_str=$(grep "HOST='$host'" $conf)
|
eval $host_str
|
||||||
|
|
||||||
for key in $host_str; do
|
if [ -z "$(echo $ENCODINGS | grep -wi $encoding )" ]; then
|
||||||
eval ${key%%=*}=${key#*=}
|
echo "Error: encoding $encoding not exist"
|
||||||
done
|
log_event "$E_NOTEXIST $EVENT"
|
||||||
|
exit $E_NOTEXIST
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Increasing db_bases usage value
|
# Increase database host value
|
||||||
U_DB_BASES=$((U_DB_BASES + 1))
|
increase_dbhost_values() {
|
||||||
# Adding user to SYS_USERS pool
|
host_str=$(grep "HOST='$host'" $VESTA/conf/$type.conf)
|
||||||
|
eval $host_str
|
||||||
|
|
||||||
|
old_dbbases="U_DB_BASES='$U_DB_BASES'"
|
||||||
|
new_dbbases="U_DB_BASES='$((U_DB_BASES + 1))'"
|
||||||
if [ -z "$U_SYS_USERS" ]; then
|
if [ -z "$U_SYS_USERS" ]; then
|
||||||
U_SYS_USERS="$user"
|
old_users="U_SYS_USERS=''"
|
||||||
|
new_users="U_SYS_USERS='$user'"
|
||||||
else
|
else
|
||||||
check_users=$(echo $U_SYS_USERS|sed -e "s/,/\n/g"|grep -w "$user")
|
old_users="U_SYS_USERS='$U_SYS_USERS'"
|
||||||
if [ -z "$check_users" ]; then
|
new_users="U_SYS_USERS='$U_SYS_USERS'"
|
||||||
U_SYS_USERS="$U_SYS_USERS,$user"
|
if [ -z "$(echo $U_SYS_USERS|sed -e "s/,/\n/g"|grep -w $user)" ]; then
|
||||||
|
old_users="U_SYS_USERS='$U_SYS_USERS'"
|
||||||
|
new_users="U_SYS_USERS='$U_SYS_USERS,$user'"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Concatenating db string
|
sed -i "s/$old_dbbases/$new_dbbases/g" $VESTA/conf/$type.conf
|
||||||
case $type in
|
sed -i "s/$old_users/$new_users/g" $VESTA/conf/$type.conf
|
||||||
mysql) new_str="HOST='$HOST' USER='$USER' PASSWORD='$PASSWORD'";
|
|
||||||
new_str="$new_str PORT='$PORT' MAX_DB='$MAX_DB'";
|
|
||||||
new_str="$new_str U_SYS_USERS='$U_SYS_USERS'";
|
|
||||||
new_str="$new_str U_DB_BASES='$U_DB_BASES' ACTIVE='$ACTIVE'";
|
|
||||||
new_str="$new_str DATE='$DATE'";;
|
|
||||||
pgsql) new_str="HOST='$HOST' USER='$USER' PASSWORD='$PASSWORD'";
|
|
||||||
new_str="$new_str PORT='$PORT' TPL='$TPL' MAX_DB='$MAX_DB'";
|
|
||||||
new_str="$new_str U_SYS_USERS='$U_SYS_USERS'";
|
|
||||||
new_str="$new_str U_DB_BASES='$U_DB_BASES' ACTIVE='$ACTIVE'";
|
|
||||||
new_str="$new_str DATE='$DATE'";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Changing config
|
|
||||||
sed -i "s/$host_str/$new_str/g" $conf
|
|
||||||
}
|
}
|
||||||
|
|
||||||
decrease_db_value() {
|
# Decrease database host value
|
||||||
# Defining vars
|
decrease_dbhost_values() {
|
||||||
conf="$VESTA/conf/$type.conf"
|
host_str=$(grep "HOST='$host'" $VESTA/conf/$type.conf)
|
||||||
host_str=$(grep "HOST='$host'" $conf)
|
eval $host_str
|
||||||
|
|
||||||
for key in $host_str; do
|
old_dbbases="U_DB_BASES='$U_DB_BASES'"
|
||||||
eval ${key%%=*}=${key#*=}
|
new_dbbases="U_DB_BASES='$((U_DB_BASES - 1))'"
|
||||||
done
|
old_users="U_SYS_USERS='$U_SYS_USERS'"
|
||||||
|
U_SYS_USERS=$(echo "$U_SYS_USERS" |\
|
||||||
|
sed -e "s/,/\n/g"|\
|
||||||
|
sed -e "s/^$users$//g"|\
|
||||||
|
sed -e "/^$/d"|\
|
||||||
|
sed -e ':a;N;$!ba;s/\n/,/g')
|
||||||
|
new_users="U_SYS_USERS='$U_SYS_USERS'"
|
||||||
|
|
||||||
# Decreasing db_bases usage value
|
sed -i "s/$old_dbbases/$new_dbbases/g" $VESTA/conf/$type.conf
|
||||||
U_DB_BASES=$((U_DB_BASES - 1))
|
sed -i "s/$old_users/$new_users/g" $VESTA/conf/$type.conf
|
||||||
|
|
||||||
# Checking user databases on that host
|
|
||||||
udb=$(grep "TYPE='$type'" $USER_DATA/db.conf|grep "HOST='$host'"|wc -l)
|
|
||||||
if [ 2 -gt "$udb" ]; then
|
|
||||||
U_SYS_USERS=$(echo "$U_SYS_USERS" | sed -e "s/,/\n/g" |\
|
|
||||||
sed -e "/^$user$/d" | sed -e :a -e '$!N;s/\n/,/;ta')
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Concatenating db string
|
|
||||||
case $type in
|
|
||||||
mysql) new_str="HOST='$HOST' USER='$USER' PASSWORD='$PASSWORD'";
|
|
||||||
new_str="$new_str PORT='$PORT'";
|
|
||||||
new_str="$new_str MAX_DB='$MAX_DB' U_SYS_USERS='$U_SYS_USERS'";
|
|
||||||
new_str="$new_str U_DB_BASES='$U_DB_BASES' ACTIVE='$ACTIVE'";
|
|
||||||
new_str="$new_str DATE='$DATE'";;
|
|
||||||
pgsql) new_str="HOST='$HOST' USER='$USER' PASSWORD='$PASSWORD'";
|
|
||||||
new_str="$new_str PORT='$PORT' TPL='$TPL'";
|
|
||||||
new_str="$new_str MAX_DB='$MAX_DB'";
|
|
||||||
new_str="$new_str U_SYS_USERS='$U_SYS_USERS'";
|
|
||||||
new_str="$new_str U_DB_BASES='$U_DB_BASES' ACTIVE='$ACTIVE'";
|
|
||||||
new_str="$new_str DATE='$DATE'";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Changing config
|
|
||||||
sed -i "s/$host_str/$new_str/g" $conf
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Create MySQL database
|
||||||
create_db_mysql() {
|
create_db_mysql() {
|
||||||
# Defining vars
|
|
||||||
host_str=$(grep "HOST='$host'" $VESTA/conf/mysql.conf)
|
host_str=$(grep "HOST='$host'" $VESTA/conf/mysql.conf)
|
||||||
for key in $host_str; do
|
eval $host_str
|
||||||
eval ${key%%=*}=${key#*=}
|
|
||||||
done
|
|
||||||
sql="mysql -h $HOST -u $USER -p$PASSWORD -P$PORT -e"
|
|
||||||
|
|
||||||
# Checking empty vars
|
|
||||||
if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $PORT ]; then
|
if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $PORT ]; then
|
||||||
echo "Error: config is broken"
|
echo "Error: mysql config parsing failed"
|
||||||
log_event 'debug' "$E_PARSING $EVENT"
|
log_event "$E_PARSING" "$EVENT"
|
||||||
exit $E_PARSING
|
exit $E_PARSING
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Checking connection
|
query='SELECT VERSION()'
|
||||||
$sql "SELECT VERSION()" >/dev/null 2>&1; code="$?"
|
mysql -h $HOST -u $USER -p$PASSWORD -P $PORT -e "$query" &> /dev/null
|
||||||
if [ '0' -ne "$code" ]; then
|
if [ '0' -ne "$?" ]; then
|
||||||
echo "Error: Connect failed"
|
echo "Error: Connection failed"
|
||||||
log_event 'debug' "$E_DB $EVENT"
|
log_event "$E_DB $EVENT"
|
||||||
exit $E_DB
|
exit $E_DB
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Adding database & checking result
|
query="CREATE DATABASE $database CHARACTER SET $encoding"
|
||||||
$sql "CREATE DATABASE $database CHARACTER SET $encoding" > /dev/null 2>&1
|
mysql -h $HOST -u $USER -p$PASSWORD -P $PORT -e "$query" &> /dev/null
|
||||||
code="$?"
|
|
||||||
if [ '0' -ne "$code" ]; then
|
query="GRANT ALL ON $database.* TO '$dbuser'@'%' IDENTIFIED BY '$dbpass'"
|
||||||
echo "Error: Connect failed"
|
mysql -h $HOST -u $USER -p$PASSWORD -P $PORT -e "$query" &> /dev/null
|
||||||
log_event 'debug' "$E_DB $EVENT"
|
|
||||||
exit $E_DB
|
if [ "$HOST" = 'localhost' ]; then
|
||||||
|
query="GRANT ALL ON $database.* TO '$dbuser'@'localhost'
|
||||||
|
IDENTIFIED BY '$dbpass'"
|
||||||
|
mysql -h $HOST -u $USER -p$PASSWORD -P $PORT -e "$query" &> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Adding user with password (% will give access to db from any ip)
|
|
||||||
$sql "GRANT ALL ON $database.* TO '$db_user'@'%' \
|
|
||||||
IDENTIFIED BY '$db_password'"
|
|
||||||
|
|
||||||
# Adding grant for localhost (% doesn't do that )
|
|
||||||
if [ "$host" = 'localhost' ]; then
|
|
||||||
$sql "GRANT ALL ON $database.* TO '$db_user'@'localhost' \
|
|
||||||
IDENTIFIED BY '$db_password'"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Flushing priveleges
|
|
||||||
$sql "FLUSH PRIVILEGES"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Create PostgreSQL database
|
||||||
create_db_pgsql() {
|
create_db_pgsql() {
|
||||||
# Defining vars
|
|
||||||
host_str=$(grep "HOST='$host'" $VESTA/conf/pgsql.conf)
|
host_str=$(grep "HOST='$host'" $VESTA/conf/pgsql.conf)
|
||||||
for key in $host_str; do
|
eval $host_str
|
||||||
eval ${key%%=*}=${key#*=}
|
|
||||||
done
|
|
||||||
|
|
||||||
export PGPASSWORD="$PASSWORD"
|
export PGPASSWORD="$PASSWORD"
|
||||||
sql="psql -h $HOST -U $USER -p $PORT -c"
|
|
||||||
|
|
||||||
# Checking empty vars
|
|
||||||
if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $TPL ]; then
|
if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $TPL ]; then
|
||||||
echo "Error: config is broken"
|
echo "Error: postgresql config parsion failed"
|
||||||
log_event 'debug' "$E_PARSING $EVENT"
|
log_event "$E_PARSING" "$EVENT"
|
||||||
exit $E_PARSING
|
exit $E_PARSING
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Checking connection
|
query='SELECT VERSION()'
|
||||||
$sql "SELECT VERSION()" >/dev/null 2>&1;code="$?"
|
psql -h $HOST -U $USER -p $PORT -c "$query" &> /dev/null
|
||||||
if [ '0' -ne "$code" ]; then
|
if [ '0' -ne "$?" ]; then
|
||||||
echo "Error: Connect failed"
|
echo "Error: Connection failed"
|
||||||
log_event 'debug' "$E_DB $EVENT"
|
log_event "$E_DB" "$EVENT"
|
||||||
exit $E_DB
|
exit $E_DB
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Adding new role
|
query="CREATE ROLE $db_user WITH LOGIN PASSWORD '$db_password'"
|
||||||
$sql "CREATE ROLE $db_user WITH LOGIN PASSWORD '$db_password'" >/dev/null
|
psql -h $HOST -U $USER -p $PORT -c "$query" &> /dev/null
|
||||||
code=$?
|
|
||||||
if [ '0' -ne "$code" ]; then
|
|
||||||
echo "Error: Connect failed"
|
|
||||||
log_event 'debug' "$E_DB $EVENT"
|
|
||||||
exit $E_DB
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Adding database & checking result
|
query="CREATE DATABASE $database OWNER $db_user"
|
||||||
sql_q="CREATE DATABASE $database OWNER $db_user" > /dev/null
|
|
||||||
if [ "$TPL" = 'template0' ]; then
|
if [ "$TPL" = 'template0' ]; then
|
||||||
sql_q="$sql_q ENCODING '$encoding' TEMPLATE $TPL" > /dev/null
|
query="$query ENCODING '$encoding' TEMPLATE $TPL"
|
||||||
else
|
else
|
||||||
sql_q="$sql_q TEMPLATE $TPL" > /dev/null
|
query="$query TEMPLATE $TPL"
|
||||||
fi
|
fi
|
||||||
$sql "$sql_q" >/dev/null
|
psql -h $HOST -U $USER -p $PORT -c "$query" &> /dev/null
|
||||||
|
|
||||||
|
query="GRANT ALL PRIVILEGES ON DATABASE $database TO $db_user"
|
||||||
|
psql -h $HOST -U $USER -p $PORT -c "$query" &> /dev/null
|
||||||
|
|
||||||
|
query="GRANT CONNECT ON DATABASE template1 to $db_user"
|
||||||
|
psql -h $HOST -U $USER -p $PORT -c "$query" &> /dev/null
|
||||||
|
|
||||||
$sql "GRANT ALL PRIVILEGES ON DATABASE $database TO $db_user" > /dev/null
|
|
||||||
$sql "GRANT CONNECT ON DATABASE template1 to $db_user" > /dev/null
|
|
||||||
export PGPASSWORD='pgsql'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is_db_host_new() {
|
is_dbhost_new() {
|
||||||
if [ -e "$VESTA/conf/$type.conf" ]; then
|
if [ -e "$VESTA/conf/$type.conf" ]; then
|
||||||
check_host=$(grep "HOST='$host'" $VESTA/conf/$type.conf)
|
check_host=$(grep "HOST='$host'" $VESTA/conf/$type.conf)
|
||||||
if [ ! -z "$check_host" ]; then
|
if [ ! -z "$check_host" ]; then
|
||||||
echo "Error: db host exist"
|
echo "Error: db host exist"
|
||||||
log_event 'debug' "$E_EXISTS $EVENT"
|
log_event "$E_EXISTS" "$EVENT"
|
||||||
exit $E_EXISTS
|
exit $E_EXISTS
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -840,28 +757,3 @@ get_disk_db_pgsql() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
increase_dbhost_values() {
|
|
||||||
conf="$VESTA/conf/$type.conf"
|
|
||||||
|
|
||||||
# Parsing conf
|
|
||||||
dbhost_str=$(grep -n "HOST='$host'" $conf)
|
|
||||||
str_number=$(echo $dbhost_str | cut -f 1 -d ':')
|
|
||||||
str=$(echo $dbhost_str | cut -f 2 -d ':')
|
|
||||||
|
|
||||||
# Reading key=values
|
|
||||||
eval $str
|
|
||||||
|
|
||||||
# Defining clean key
|
|
||||||
c_key=$(echo "${key//$/}")
|
|
||||||
|
|
||||||
eval old="${key}"
|
|
||||||
|
|
||||||
# Escaping slashes
|
|
||||||
old=$(echo "$old" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g')
|
|
||||||
new=$(echo "$value" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g')
|
|
||||||
|
|
||||||
# Updating conf
|
|
||||||
sed -i "$str_number s/$c_key='${old//\*/\\*}'/$c_key='${new//\*/\\*}'/g"\
|
|
||||||
$conf
|
|
||||||
}
|
|
||||||
|
|
|
@ -622,8 +622,8 @@ validate_format(){
|
||||||
backup) validate_format_date "$arg" ;;
|
backup) validate_format_date "$arg" ;;
|
||||||
database) validate_format_database "$arg" ;;
|
database) validate_format_database "$arg" ;;
|
||||||
day) validate_format_mhdmw "$arg" $arg_name ;;
|
day) validate_format_mhdmw "$arg" $arg_name ;;
|
||||||
db_password) validate_format_password "$arg" ;;
|
dbpass) validate_format_password "$arg" ;;
|
||||||
db_user) validate_format_database "$arg" ;;
|
dbuser) validate_format_database "$arg" ;;
|
||||||
dkim) validate_format_boolean "$arg" ;;
|
dkim) validate_format_boolean "$arg" ;;
|
||||||
dkim_size) validate_format_key_size "$arg" ;;
|
dkim_size) validate_format_key_size "$arg" ;;
|
||||||
domain) validate_format_domain "$arg" ;;
|
domain) validate_format_domain "$arg" ;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue