-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [FIX] Wrong behavior when importing CSV. Thanks to @hoboristi for t…
…he feedback. Closes #1211 * [FIX] Wrong behavior when displaying passwords with scpecial characters. Thanks to @opeshm for the feedback. Closes #1207 Signed-off-by: Rubén D <[email protected]>
- Loading branch information
Showing
8 changed files
with
201 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
DB_HOST=$(docker inspect syspass-db-test --format {{.NetworkSettings.Networks.bridge.IPAddress}}) | ||
|
||
if [ -z "${DB_HOST}" ]; then | ||
echo "Unknown host" | ||
exit 1 | ||
fi | ||
|
||
DB_TABLE=$1 | ||
DUMP_PATH=$2 | ||
|
||
if [ -z ${DB_TABLE} ]; then | ||
echo "Table not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${DUMP_PATH} ]; then | ||
echo "Dump path not set" | ||
exit 1 | ||
fi | ||
|
||
mysqldump --hex-blob -t -u root --password=syspass-test --host=${DB_HOST} --xml syspass-test `echo "${DB_TABLE^}"` >> ${DUMP_PATH}/syspass_${DB_TABLE}.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
DB_HOST=$(docker inspect syspass-db-test --format {{.NetworkSettings.Networks.bridge.IPAddress}}) | ||
|
||
if [[ -z "${DB_HOST}" ]]; then | ||
echo "Unknown host" | ||
exit 1 | ||
fi | ||
|
||
SQL_FILE=$1 | ||
DB_NAME=$2 | ||
PROJECT_DIR=$3 | ||
|
||
if [[ ! -e "${SQL_FILE}" ]]; then | ||
echo "SQL file does not exist: ${SQL_FILE}" | ||
exit 1 | ||
fi | ||
|
||
echo "Database host: ${DB_HOST}" | ||
echo "Database name: ${DB_NAME}" | ||
|
||
case ${DB_NAME} in | ||
"syspass") | ||
mysql -h ${DB_HOST} -u root -psyspass ${DB_NAME} < ${PROJECT_DIR}/schemas/dbstructure.sql | ||
mysql -h ${DB_HOST} -u root -psyspass ${DB_NAME} < ${SQL_FILE} | ||
;; | ||
"syspass-test") | ||
mysql -h ${DB_HOST} -u root -psyspass -e 'DROP DATABASE IF EXISTS `'"${DB_NAME}"'`;' | ||
mysql -h ${DB_HOST} -u root -psyspass -e 'CREATE DATABASE `'"${DB_NAME}"'` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;' | ||
mysql -h ${DB_HOST} -u root -psyspass ${DB_NAME} < ${SQL_FILE} | ||
;; | ||
*) | ||
echo "Database name not set" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
if [[ $? -eq 0 ]]; then | ||
echo "Database data imported" | ||
fi |