Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit 55d80ba

Browse files
committed
Remove insecure password warning during backup-db and import-db.
1 parent 5c6b38f commit 55d80ba

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

guest/cli/commands/backup-db

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if [ $dryrun -eq 0 ]; then
5050

5151
mkdir -p /vagrant/sql
5252

53-
mysqldump -u wordpress -pwordpress wordpress > ${bakfile}
53+
mysqldump -u wordpress -pwordpress wordpress 2>&1 | grep -v "Warning: Using a password on the command line interface can be insecure." > ${bakfile}
5454

5555
result="$?"
5656

@@ -68,6 +68,7 @@ if [[ "$*" == *"--echo-filename"* ]]; then
6868

6969
fi
7070

71+
echo_if_not_quiet "$*", "=Database backed up."
7172

7273

7374

guest/cli/commands/import-db

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if [ "${bakfile}" == "${importfile}" ]; then
4646

4747
fi
4848

49-
echo_if_not_quiet "$*", "^Backing up database..."
49+
echo_if_not_quiet "$*", "=Backing up database..."
5050

5151
bakfile=$(box backup-db --quiet --echo-filename)
5252

@@ -64,11 +64,18 @@ if [[ "$*" == *" error "* ]]; then
6464

6565
fi
6666

67-
echo_if_not_quiet "$*", "^Database backed-up to ${bakfile}..."
67+
echo_if_not_quiet "$*", "^Database backed-up to ${bakfile}."
68+
69+
echo_if_not_quiet "$*", "=Dropping any prior tables..."
70+
mysql -u wordpress -pwordpress -Nse "show tables;" wordpress 2>&1 | grep -v "Warning:" > /tmp/mysql-table-list.txt
71+
cat /tmp/mysql-table-list.txt | while read table; do mysql -u wordpress -pwordpress -e "drop table $table" wordpress 2>&1 | grep -v "Warning:"; done
72+
rm /tmp/mysql-table-list.txt
73+
echo_if_not_quiet "$*", "^Tables dropped."
6874

6975
echo_if_not_quiet "$*", "=Importing database from ${importfile}..."
76+
mysql -u wordpress -pwordpress wordpress < ${importfile} 2>&1 | grep -v "Warning:"
77+
echo_if_not_quiet "$*", "=Database imported."
7078

71-
mysql -u wordpress -pwordpress wordpress < ${importfile}
7279

7380

7481

0 commit comments

Comments
 (0)