mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-11 15:03:20 -05:00
Merge pull request #2542 from nzalev/add-mysql/mariadb-to-getbackupconfig
Added mysql/mariadb to getBackupConfig
This commit is contained in:
commit
84b9d3df09
13
db.js
13
db.js
@ -1532,14 +1532,19 @@ module.exports.CreateDB = function (parent, func) {
|
||||
obj.getBackupConfig = function () {
|
||||
var r = '', backupPath = parent.backuppath;
|
||||
if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; }
|
||||
const dbname = (parent.args.mongodbname) ? (parent.args.mongodbname) : 'meshcentral';
|
||||
|
||||
var dbname = 'meshcentral';
|
||||
if (parent.args.mongodbname) { dbname = parent.args.mongodbname; }
|
||||
else if (parent.args.mariadb.database) { dbname = parent.args.mariadb.database; }
|
||||
else if (parent.args.mysql.database) { dbname = parent.args.mysql.database; }
|
||||
|
||||
const currentDate = new Date();
|
||||
const fileSuffix = currentDate.getFullYear() + '-' + padNumber(currentDate.getMonth() + 1, 2) + '-' + padNumber(currentDate.getDate(), 2) + '-' + padNumber(currentDate.getHours(), 2) + '-' + padNumber(currentDate.getMinutes(), 2);
|
||||
const newAutoBackupFile = 'meshcentral-autobackup-' + fileSuffix;
|
||||
const newAutoBackupPath = parent.path.join(backupPath, newAutoBackupFile);
|
||||
|
||||
r += 'DB Name: ' + dbname + '\r\n';
|
||||
r += 'DB Type: ' + ['None', 'NeDB', 'MongoJS', 'MongoDB'][obj.databaseType] + '\r\n';
|
||||
r += 'DB Type: ' + ['None', 'NeDB', 'MongoJS', 'MongoDB', 'MariaDB', 'MySQL'][obj.databaseType] + '\r\n';
|
||||
r += 'BackupPath: ' + backupPath + '\r\n';
|
||||
r += 'newAutoBackupFile: ' + newAutoBackupFile + '\r\n';
|
||||
r += 'newAutoBackupPath: ' + newAutoBackupPath + '\r\n';
|
||||
@ -1563,6 +1568,10 @@ module.exports.CreateDB = function (parent, func) {
|
||||
if (typeof parent.config.settings.autobackup.mongodumppath != 'string') { r += 'Bad mongodumppath type\r\n'; }
|
||||
else { r += 'MongoDump Path: ' + parent.config.settings.autobackup.mongodumppath + '\r\n'; }
|
||||
}
|
||||
if (parent.config.settings.autobackup.mysqldumppath != null) {
|
||||
if (typeof parent.config.settings.autobackup.mysqldumppath != 'string') { r += 'Bad mysqldump type\r\n'; }
|
||||
else { r += 'MySqlDump Path: ' + parent.config.settings.autobackup.mysqldumppath + '\r\n'; }
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
|
Loading…
Reference in New Issue
Block a user