fix mysql autoback zippassword

Signed-off-by: Simon Smith <simonsmith5521@gmail.com>
This commit is contained in:
Simon Smith 2024-08-15 13:06:40 +01:00
parent aae551dab9
commit c1e3354c91

4
db.js
View File

@ -3426,6 +3426,7 @@ module.exports.CreateDB = function (parent, func) {
var archiver = require('archiver');
var output = parent.fs.createWriteStream(newAutoBackupPath + '.zip');
var archive = null;
if (parent.config.settings.autobackup && (typeof parent.config.settings.autobackup.zippassword == 'string')) {
try {
archiver.registerFormat('zip-encrypted', require('archiver-zip-encrypted'));
archive = archiver.create('zip-encrypted', { zlib: { level: 9 }, encryptionMethod: 'aes256', password: parent.config.settings.autobackup.zippassword });
@ -3434,6 +3435,9 @@ module.exports.CreateDB = function (parent, func) {
archive = archiver('zip', { zlib: { level: 9 } });
if (func) { func('Creating encrypted ZIP failed, so falling back to normal ZIP'); }
}
} else {
archive = archiver('zip', { zlib: { level: 9 } });
}
output.on('close', function () {
obj.performingBackup = false;
if (func) { if (sqlDumpSuccess) { func('Auto-backup completed.'); } else { func('Auto-backup completed without MySQL/MariaDB database: ' + error); } }