mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-21 05:34:42 -05:00
Added check to ensure backup exists when restoring (#2779)
A check to ensure that the backup database exists before deleting the current database. Fixes #2778 Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
parent
c19dcdba44
commit
cd18b96f69
@ -496,6 +496,16 @@ class Database {
|
||||
const shmPath = Database.path + "-shm";
|
||||
const walPath = Database.path + "-wal";
|
||||
|
||||
// Make sure we have a backup to restore before deleting old db
|
||||
if (
|
||||
!fs.existsSync(this.backupPath)
|
||||
&& !fs.existsSync(shmPath)
|
||||
&& !fs.existsSync(walPath)
|
||||
) {
|
||||
log.error("db", "Backup file not found! Leaving database in failed state.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Delete patch failed db
|
||||
try {
|
||||
if (fs.existsSync(Database.path)) {
|
||||
|
Loading…
Reference in New Issue
Block a user