diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bba51a5a..1aee178f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ permalink: /docs/en-US/changelog/ * Improved provisioning output * VVV will now attempt to test Nginx configs on installation and recover ( #2604 ) * Switched to new launchpad PPA domains with HTTPS ( #2586 ) +* Improved the verboseness of the DB import scripts ( #2621 ) ### Bug Fixes diff --git a/config/homebin/db_backup b/config/homebin/db_backup index 43f6a6dd4..92669d485 100755 --- a/config/homebin/db_backup +++ b/config/homebin/db_backup @@ -6,7 +6,9 @@ set -eo pipefail set -u -export VVV_LOG="" +if [ -z "${VVV_LOG+x}" ]; then + export VVV_LOG="" +fi trap 'rm -rf $TMPFIFODIR' EXIT; TMPFIFODIR=$(mktemp -d); mkfifo $TMPFIFODIR/dbnames diff --git a/database/sql/import-sql.sh b/database/sql/import-sql.sh index f4e9eeb62..3b87606da 100755 --- a/database/sql/import-sql.sh +++ b/database/sql/import-sql.sh @@ -20,7 +20,9 @@ set -eo pipefail set -u -export VVV_LOG="" +if [ -z "${VVV_LOG+x}" ]; then + export VVV_LOG="" +fi source /srv/provision/provision-helpers.sh @@ -72,6 +74,7 @@ IFS=$(echo -en "\n\b") # Parse through each file in the directory and use the file name to # import the SQL file into the database of the same name sql_count=$(ls -1 ./*.sql* 2>/dev/null | wc -l) +vvv_info " * Found ${sql_count} database dumps" if [ "$sql_count" != 0 ] then for file in $( ls ./*.sql* ) @@ -82,6 +85,15 @@ then db_name=$(basename "${file}" .sql.gz) fi + # skip these databases + [ "${db_name}" == "mysql" ] && continue; + [ "${db_name}" == "information_schema" ] && continue; + [ "${db_name}" == "performance_schema" ] && continue; + [ "${db_name}" == "sys" ] && continue; + [ "${db_name}" == "test" ] && continue; + + vvv_info " * Processing ${db_name} dump" + # if we specified databases, only restore specified ones if [[ "${#@}" -gt 0 ]]; then FOUND=0 @@ -96,13 +108,6 @@ then fi fi - # skip these databases - [ "${db_name}" == "mysql" ] && continue; - [ "${db_name}" == "information_schema" ] && continue; - [ "${db_name}" == "performance_schema" ] && continue; - [ "${db_name}" == "sys" ] && continue; - [ "${db_name}" == "test" ] && continue; - if [ "1" == "${FORCE_RESTORE}" ]; then vvv_info " * Forcing restore of ${db_name} database, and granting the wp user access" mysql -e "DROP DATABASE IF EXISTS \`${db_name}\`" @@ -121,6 +126,7 @@ then skip="true" fi done + for include in ${include_list[@]}; do if [ "${include}" == "${db_name}" ]; then skip="false" @@ -160,4 +166,6 @@ else vvv_success " * No custom databases to import" fi +vvv_success " * Database importing finished" + IFS=$SAVEIFS