Skip to content

remove useless if condition #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,11 @@ if [[ -n "$DB_RESTORE_TARGET" ]]; then
# Execute additional scripts for pre backup restore processing. For example,
# uncompress a tarball that contains the tarballs for the sql dump and a
# wordpress installation.
if [ -d /scripts.d/pre-restore/ ]; then
for i in $(ls /scripts.d/pre-restore/*.sh); do
if [ -x $i ]; then
DB_RESTORE_TARGET=${DB_RESTORE_TARGET} DB_DUMP_DEBUG=${DB_DUMP_DEBUG} $i
fi
done
fi
for i in /scripts.d/pre-restore/*.sh; do
if [ -x $i ]; then
DB_RESTORE_TARGET=${DB_RESTORE_TARGET} DB_DUMP_DEBUG=${DB_DUMP_DEBUG} $i
fi
done
uri_parser ${DB_RESTORE_TARGET}
if [[ "${uri[schema]}" == "file" ]]; then
cp $DB_RESTORE_TARGET $TMPRESTORE 2>/dev/null
Expand Down Expand Up @@ -154,17 +152,15 @@ if [[ -n "$DB_RESTORE_TARGET" ]]; then
fi
# Execute additional scripts for post backup restore processing. For example,
# uncompress a tarball that contains the files of a wordpress installation
if [ -d /scripts.d/post-restore/ ]; then
for i in $(ls /scripts.d/post-restore/*.sh); do
if [ -x $i ]; then
DB_RESTORE_TARGET=${DB_RESTORE_TARGET} DB_DUMP_DEBUG=${DB_DUMP_DEBUG} $i
fi
done
fi
for i in /scripts.d/post-restore/*.sh; do
if [ -x $i ]; then
DB_RESTORE_TARGET=${DB_RESTORE_TARGET} DB_DUMP_DEBUG=${DB_DUMP_DEBUG} $i
fi
done
else
# wait for the next time to start a backup
# for debugging
echo Starting at $(date)
echo "Starting at $(date)"
last_run=0
current_time=$(date +"%s")
freq_time=$(($DB_DUMP_FREQ*60))
Expand Down
30 changes: 13 additions & 17 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,12 @@ function do_dump() {
# Execute additional scripts for pre processing. For example, uncompress a
# backup file containing this db backup and a second tar file with the
# contents of a wordpress install so they can be restored.
if [ -d /scripts.d/pre-backup/ ]; then
for i in $(ls /scripts.d/pre-backup/*.sh); do
if [ -x $i ]; then
NOW=${now} DUMPFILE=${TMPDIR}/${TARGET} DUMPDIR=${TMPDIR} DB_DUMP_DEBUG=${DB_DUMP_DEBUG} $i
[ $? -ne 0 ] && return 1
fi
done
fi
for i in /scripts.d/pre-backup/*.sh; do
if [ -x $i ]; then
NOW=${now} DUMPFILE=${TMPDIR}/${TARGET} DUMPDIR=${TMPDIR} DB_DUMP_DEBUG=${DB_DUMP_DEBUG} $i
[ $? -ne 0 ] && return 1
fi
done

# do the dump
workdir="${TMP_PATH}/backup.$$"
Expand All @@ -138,7 +136,7 @@ function do_dump() {
exclude_list[$i]="true"
done
for onedb in $DB_LIST; do
if [ -v exclude_list[$onedb] ]; then
if [[ -v exclude_list[$onedb] ]]; then
# skip db if it is in the exclude list
continue
fi
Expand All @@ -165,14 +163,12 @@ function do_dump() {
# Execute additional scripts for post processing. For example, create a new
# backup file containing this db backup and a second tar file with the
# contents of a wordpress install.
if [ -d /scripts.d/post-backup/ ]; then
for i in $(ls /scripts.d/post-backup/*.sh); do
if [ -x $i ]; then
NOW=${now} DUMPFILE=${TMPDIR}/${SOURCE} DUMPDIR=${TMPDIR} DB_DUMP_DEBUG=${DB_DUMP_DEBUG} $i
[ $? -ne 0 ] && return 1
fi
done
fi
for i in ls /scripts.d/post-backup/*.sh; do
if [ -x $i ]; then
NOW=${now} DUMPFILE=${TMPDIR}/${SOURCE} DUMPDIR=${TMPDIR} DB_DUMP_DEBUG=${DB_DUMP_DEBUG} $i
[ $? -ne 0 ] && return 1
fi
done

# Execute a script to modify the name of the source file path before uploading to the dump target
# For example, modifying the name of the source dump file from the default, e.g. db-other-files-combined.tar.$EXTENSION
Expand Down