mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
Store failed gravity restoration status in message table
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
9a9af719f0
commit
633c971a44
@ -67,6 +67,11 @@ CREATE TABLE info
|
|||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO "info" VALUES('version','19');
|
INSERT INTO "info" VALUES('version','19');
|
||||||
|
/* This is a flag to indicate if gravity was restored from a backup
|
||||||
|
false = not restored,
|
||||||
|
failed = restoration failed due to no backup
|
||||||
|
other string = restoration successful with the string being the backup file used */
|
||||||
|
INSERT INTO "info" VALUES('gravity_restored','false');
|
||||||
|
|
||||||
CREATE TABLE domain_audit
|
CREATE TABLE domain_audit
|
||||||
(
|
(
|
||||||
|
@ -353,12 +353,13 @@ gravity_CheckDNSResolutionAvailable() {
|
|||||||
# 0 - If the backup is successfully restored.
|
# 0 - If the backup is successfully restored.
|
||||||
# 1 - If no backup is available or if the restoration fails.
|
# 1 - If no backup is available or if the restoration fails.
|
||||||
try_restore_backup () {
|
try_restore_backup () {
|
||||||
local num
|
local num filename
|
||||||
num=$1
|
num=$1
|
||||||
|
filename="${gravityBCKfile}.${num}"
|
||||||
# Check if a backup exists
|
# Check if a backup exists
|
||||||
if [ -f "${gravityBCKfile}.${num}" ]; then
|
if [ -f "${filename}" ]; then
|
||||||
echo -e " ${INFO} Attempting to restore previous database from backup no. ${num}"
|
echo -e " ${INFO} Attempting to restore previous database from backup no. ${num}"
|
||||||
cp "${gravityBCKfile}.${num}" "${gravityDBfile}"
|
cp "${filename}" "${gravityDBfile}"
|
||||||
|
|
||||||
# If the backup was successfully copied, prepare a new gravity database from
|
# If the backup was successfully copied, prepare a new gravity database from
|
||||||
# it
|
# it
|
||||||
@ -372,6 +373,7 @@ try_restore_backup () {
|
|||||||
gravity_Cleanup "error"
|
gravity_Cleanup "error"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
pihole-FTL sqlite3 "${gravityTEMPfile}" "INSERT OR REPLACE INTO info (property,value) values ('gravity_restored','${filename}');"
|
||||||
echo -e " ${TICK} Successfully restored from backup (${gravityBCKfile}.${num})"
|
echo -e " ${TICK} Successfully restored from backup (${gravityBCKfile}.${num})"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
@ -434,6 +436,7 @@ gravity_DownloadBlocklists() {
|
|||||||
# If none of the attempts worked, return 1
|
# If none of the attempts worked, return 1
|
||||||
if [[ "${i}" -eq 10 ]]; then
|
if [[ "${i}" -eq 10 ]]; then
|
||||||
return 1
|
return 1
|
||||||
|
pihole-FTL sqlite3 "${gravityTEMPfile}" "INSERT OR REPLACE INTO info (property,value) values ('gravity_restored','failed');"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e " ${TICK} ${str}"
|
echo -e " ${TICK} ${str}"
|
||||||
|
Loading…
Reference in New Issue
Block a user