Skip to content

Commit 3e404e5

Browse files
committed
Remove some trivial helper functions
They were actually leading to double password reading in the `load` command.
1 parent d8f0697 commit 3e404e5

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

sql/dj_setup_database.in

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -272,23 +272,6 @@ install_examples()
272272
( cd "$EXAMPLEPROBDIR" && yes y | "$BINDIR"/import-contest )
273273
}
274274

275-
uninstall_helper()
276-
{
277-
read_dbpasswords
278-
remove_db_users
279-
}
280-
281-
create_db_users_helper()
282-
{
283-
read_dbpasswords
284-
create_db_users
285-
verbose "Created empty database and users."
286-
}
287-
288-
create_database_dump () {
289-
mysqldump $(mysql_options) --opt --skip-lock-tables "$DBNAME" | pv | gzip > "$DATABASEDUMPDIR/${1}.sql.gz"
290-
}
291-
292275
### Script starts here ###
293276

294277
# Parse command-line options:
@@ -345,7 +328,8 @@ genpass)
345328
;;
346329

347330
uninstall)
348-
uninstall_helper
331+
read_dbpasswords
332+
remove_db_users
349333
;;
350334

351335
install-examples)
@@ -364,7 +348,8 @@ install-loadtest)
364348
;;
365349

366350
create-db-users)
367-
create_db_users_helper
351+
read_dbpasswords
352+
create_db_users
368353
;;
369354

370355
update-password)
@@ -413,7 +398,8 @@ dump)
413398
exit 1
414399
fi
415400

416-
if [ -f "${DATABASEDUMPDIR}/${DUMPNAME}.sql.gz" ]; then
401+
DUMPFILE="${DATABASEDUMPDIR}/${DUMPNAME}.sql.gz"
402+
if [ -f "$DUMPFILE" ]; then
417403
while true; do
418404
printf "Overwrite existing database dump (y/N)? "
419405
read -r yn
@@ -423,7 +409,7 @@ dump)
423409
esac
424410
done
425411
fi
426-
create_database_dump "$DUMPNAME"
412+
mysqldump $(mysql_options) --opt --skip-lock-tables "$DBNAME" | pv | gzip > "$DUMPFILE"
427413
;;
428414

429415
load)
@@ -465,8 +451,8 @@ load)
465451
fi
466452

467453
read_dbpasswords
468-
uninstall_helper
469-
create_db_users_helper
454+
remove_db_users
455+
create_db_users
470456
pv "${FILE}" | gunzip | mysql "$DBNAME"
471457
;;
472458

0 commit comments

Comments
 (0)