import db
Fixed successfull message even when error. Also, missing mysql package check.
This commit is contained in:
parent
8fb402d039
commit
af49aaf3ae
2 changed files with 14 additions and 5 deletions
18
lib/webin
18
lib/webin
|
@ -1081,6 +1081,7 @@ database_import() {
|
|||
fi
|
||||
|
||||
check_external_db_saved
|
||||
echo "${dim}Wait while we import your db... ${end}"
|
||||
|
||||
if [[ -n $external_db ]]; then
|
||||
external_db_parse
|
||||
|
@ -1089,15 +1090,22 @@ database_import() {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
echo "${dim}Wait while we import your db... ${end}"
|
||||
sudo mysql --defaults-group-suffix=_${extdb_url}:${extdb_port}_default --connect-timeout=10 -h "$extdb_url" -P "$extdb_port" < $file
|
||||
sudo mysql --defaults-group-suffix=_${extdb_url}:${extdb_port}_default --connect-timeout=10 -h "$extdb_url" -P "$extdb_port" -e "FLUSH PRIVILEGES;"
|
||||
echo "${gre}Database successfully imported!${end}"
|
||||
if [[ $? == "0" ]]; then
|
||||
sudo mysql --defaults-group-suffix=_${extdb_url}:${extdb_port}_default --connect-timeout=10 -h "$extdb_url" -P "$extdb_port" -e "FLUSH PRIVILEGES;"
|
||||
echo "${gre}Database successfully imported!${end}"
|
||||
else
|
||||
echo "${red}[ERROR] An error occurred while we tried to import your database!${end}"
|
||||
fi
|
||||
elif [[ -z $external_db && $(check_mysql_connection localhost) == "true" ]]; then
|
||||
check_for_mysql -ask
|
||||
sudo mysql -u admin < $file
|
||||
sudo mysql --connect-timeout=10 --user=admin -e "FLUSH PRIVILEGES;"
|
||||
echo "${gre}Database successfully imported!${end}"
|
||||
if [[ $? == "0" ]]; then
|
||||
sudo mysql --connect-timeout=10 --user=admin -e "FLUSH PRIVILEGES;"
|
||||
echo "${gre}Database successfully imported!${end}"
|
||||
else
|
||||
echo "${red}[ERROR] An error occurred while we tried to import your database!${end}"
|
||||
fi
|
||||
else
|
||||
echo "${red}[ERROR] A connection can not be established with MySQL/MariaDB localhost!${end}"
|
||||
exit 1
|
||||
|
|
|
@ -263,6 +263,7 @@ elif [[ -n $datadog ]]; then
|
|||
|
||||
|
||||
elif [[ -n $db_import ]]; then
|
||||
check_for_mysql
|
||||
database_import
|
||||
nginx_not="true" # Nginx-Reload not-needed.
|
||||
|
||||
|
|
Loading…
Reference in a new issue