Indicate proper error if auto-backup path is not correct (#4483)
Ylian Saint-Hilaire committed
Sep 2, 2022 at 14:37 UTC
2eb8cbf2d6bc99eedbb692fc2f4edbc738a5b70d
1 file changed
+3
-1
db.js
+3
-1
@@ -2763,7 +2763,8 @@ module.exports.CreateDB = function (parent, func) {
2763
// Check that we have access to MongoDump
2764
var backupPath = parent.backuppath;
2765
if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; }
2766
- try { parent.fs.mkdirSync(backupPath); } catch (e) { }
2766
+ try { parent.fs.mkdirSync(backupPath); } catch (ex) { }
2767
+ if (parent.fs.existsSync(backupPath) == false) { func(1, "Backup folder \"" + backupPath + "\" does not exist, database auto-backup will not be performed."); return; }
2768
2769
var cmd = buildMongoDumpCommand();
2770
cmd += (parent.platform == 'win32') ? ' --archive=\"nul\"' : ' --archive=\"/dev/null\"';
@@ -2786,6 +2787,7 @@ module.exports.CreateDB = function (parent, func) {
2787
var backupPath = parent.backuppath;
2788
if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; }
2789
try { parent.fs.mkdirSync(backupPath); } catch (e) { }
2790
+ if (parent.fs.existsSync(backupPath) == false) { func(1, "Backup folder \"" + backupPath + "\" does not exist, database auto-backup will not be performed."); return; }
2791
2792
var cmd = buildSqlDumpCommand();
2793
cmd += ' > ' + ((parent.platform == 'win32') ? '\"nul\"' : '\"/dev/null\"');