Fix for #2666
Ylian Saint-Hilaire committed
May 21, 2021 at 08:41 UTC
76fde352f6f7cac86df5335df86ec73391f58099
2 files changed
+7
-10
db.js
+5
-8
@@ -1644,12 +1644,6 @@ module.exports.CreateDB = function (parent, func) {
1644
return cmd;
1645
}
1646
1647
- // MongoDB mongodump requires that the URL have a / at the end of the path. If not present, this will add it.
1648
- function terminateUrlPathWithSlash(str) {
1649
- const u = require('url').parse(str);
1650
- return u.protocol + '//' + u.host + (u.pathname ? u.pathname : '') + '/' + (u.search ? u.search : '');
1651
- }
1652
-
1647
// Check that the server is capable of performing a backup
1648
obj.checkBackupCapability = function (func) {
1649
if ((parent.config.settings.autobackup == null) || (parent.config.settings.autobackup == false)) { func(); }
@@ -1662,12 +1656,15 @@ module.exports.CreateDB = function (parent, func) {
1656
var mongoDumpPath = 'mongodump';
1657
if (parent.config.settings.autobackup && parent.config.settings.autobackup.mongodumppath) { mongoDumpPath = parent.config.settings.autobackup.mongodumppath; }
1658
var cmd = '"' + mongoDumpPath + '"';
1665
- if (dburl) { cmd = '\"' + mongoDumpPath + '\" --uri=\"' + terminateUrlPathWithSlash(dburl) + '\"'; }
1659
+ if (dburl) { cmd = '\"' + mongoDumpPath + '\" --uri=\"' + dburl + '\"'; }
1660
cmd += (parent.platform == 'win32') ? ' --archive=\"nul\"' : ' --archive=\"/dev/null\"';
1661
const child_process = require('child_process');
1662
child_process.exec(cmd, { cwd: backupPath }, function (error, stdout, stderr) {
1663
try {
1664
if ((error != null) && (error != '')) {
1665
+
1666
+ console.log(error);
1667
+
1668
if (parent.platform == 'win32') {
1669
func(1, "Unable to find mongodump.exe, MongoDB database auto-backup will not be performed.");
1670
} else {
@@ -1840,7 +1837,7 @@ module.exports.CreateDB = function (parent, func) {
1837
if (parent.config.settings.autobackup && parent.config.settings.autobackup.mongodumppath) { mongoDumpPath = parent.config.settings.autobackup.mongodumppath; }
1838
const child_process = require('child_process');
1839
var cmd = '\"' + mongoDumpPath + '\" --db=\"' + dbname + '\" --archive=\"' + newBackupPath + '.archive\"';
1843
- if (dburl) { cmd = '\"' + mongoDumpPath + '\" --uri=\"' + terminateUrlPathWithSlash(dburl) + '\" --archive=\"' + newBackupPath + '.archive\"'; }
1840
+ if (dburl) { cmd = '\"' + mongoDumpPath + '\" --uri=\"' + dburl + '\" --archive=\"' + newBackupPath + '.archive\"'; }
1841
var backupProcess = child_process.exec(cmd, { cwd: backupPath }, function (error, stdout, stderr) {
1842
try {
1843
var mongoDumpSuccess = true;
public/scripts/common-0.0.1.js
+2
-2
@@ -9,8 +9,8 @@ if (!String.prototype.startsWith) { String.prototype.startsWith = function (str)
9
if (!String.prototype.endsWith) { String.prototype.endsWith = function (str) { return this.indexOf(str, this.length - str.length) !== -1; }; }
10
11
// Quick UI functions, a bit of a replacement for jQuery
12
-function Q(x) { if (document.getElementById(x) == null) { console.log('Invalid element: ' + x); } return document.getElementById(x); } // "Q"
13
-//function Q(x) { return document.getElementById(x); } // "Q"
12
+//function Q(x) { if (document.getElementById(x) == null) { console.log('Invalid element: ' + x); } return document.getElementById(x); } // "Q"
13
+function Q(x) { return document.getElementById(x); } // "Q"
14
function QS(x) { try { return Q(x).style; } catch (x) { } } // "Q" style
15
function QE(x, y) { try { Q(x).disabled = !y; } catch (x) { } } // "Q" enable
16
function QV(x, y) { try { QS(x).display = (y ? '' : 'none'); } catch (x) { } } // "Q" visible