diff --git a/CHANGES b/CHANGES index 6239615a5..b812defbb 100644 --- a/CHANGES +++ b/CHANGES @@ -2270,4 +2270,6 @@ * mail: add active flag to mailboxes and lists * Implement OCSP stapling * security: send new browser login location notification email +* backups: add fqdn to the backup filename +* import all boxdata settings into the database diff --git a/src/backups.js b/src/backups.js index 131d8fca3..f2badcc85 100644 --- a/src/backups.js +++ b/src/backups.js @@ -986,10 +986,7 @@ function rotateBoxBackup(backupConfig, tag, options, appBackupIds, progressCallb assert.strictEqual(typeof progressCallback, 'function'); assert.strictEqual(typeof callback, 'function'); - var snapshotInfo = getSnapshotInfo('box'); - - const snapshotTime = snapshotInfo.timestamp.replace(/[T.]/g, '-').replace(/[:Z]/g,''); // add this to filename to make it unique, so it's easy to download them - const backupId = util.format('%s/box_%s_v%s', tag, snapshotTime, constants.VERSION); + const backupId = `${tag}/box_${constants.VERSION}`; const format = backupConfig.format; debug(`Rotating box backup to id ${backupId}`); @@ -1087,11 +1084,10 @@ function rotateAppBackup(backupConfig, app, tag, options, progressCallback, call const startTime = new Date(); - var snapshotInfo = getSnapshotInfo(app.id); + const snapshotInfo = getSnapshotInfo(app.id); - var manifest = snapshotInfo.restoreConfig ? snapshotInfo.restoreConfig.manifest : snapshotInfo.manifest; // compat - const snapshotTime = snapshotInfo.timestamp.replace(/[T.]/g, '-').replace(/[:Z]/g,''); // add this for unique filename which helps when downloading them - const backupId = util.format('%s/app_%s_%s_v%s', tag, app.id, snapshotTime, manifest.version); + const manifest = snapshotInfo.restoreConfig ? snapshotInfo.restoreConfig.manifest : snapshotInfo.manifest; // compat + const backupId = `${tag}/app_${app.fqdn}_v${manifest.version}`; const format = backupConfig.format; debug(`Rotating app backup of ${app.id} to id ${backupId}`); @@ -1110,7 +1106,7 @@ function rotateAppBackup(backupConfig, app, tag, options, progressCallback, call backupdb.add(backupId, data, function (error) { if (error) return callback(error); - var copy = api(backupConfig.provider).copy(backupConfig, getBackupFilePath(backupConfig, `snapshot/app_${app.id}`, format), getBackupFilePath(backupConfig, backupId, format)); + const copy = api(backupConfig.provider).copy(backupConfig, getBackupFilePath(backupConfig, `snapshot/app_${app.id}`, format), getBackupFilePath(backupConfig, backupId, format)); copy.on('progress', (message) => progressCallback({ message: `${message} (${app.fqdn})` })); copy.on('done', function (copyBackupError) { const state = copyBackupError ? exports.BACKUP_STATE_ERROR : exports.BACKUP_STATE_NORMAL;