Indicate proper error if auto-backup path is not correct (#4483)

This commit is contained in:
Ylian Saint-Hilaire 2022-09-02 14:37:12 -07:00
parent 55f56a1145
commit 2eb8cbf2d6

4
db.js
View File

@ -2763,7 +2763,8 @@ module.exports.CreateDB = function (parent, func) {
// Check that we have access to MongoDump
var backupPath = parent.backuppath;
if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; }
try { parent.fs.mkdirSync(backupPath); } catch (e) { }
try { parent.fs.mkdirSync(backupPath); } catch (ex) { }
if (parent.fs.existsSync(backupPath) == false) { func(1, "Backup folder \"" + backupPath + "\" does not exist, database auto-backup will not be performed."); return; }
var cmd = buildMongoDumpCommand();
cmd += (parent.platform == 'win32') ? ' --archive=\"nul\"' : ' --archive=\"/dev/null\"';
@ -2786,6 +2787,7 @@ module.exports.CreateDB = function (parent, func) {
var backupPath = parent.backuppath;
if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; }
try { parent.fs.mkdirSync(backupPath); } catch (e) { }
if (parent.fs.existsSync(backupPath) == false) { func(1, "Backup folder \"" + backupPath + "\" does not exist, database auto-backup will not be performed."); return; }
var cmd = buildSqlDumpCommand();
cmd += ' > ' + ((parent.platform == 'win32') ? '\"nul\"' : '\"/dev/null\"');