restore: download mail backup in restore phase
if we download it in the platform start phase, there is no way to give feedback to the user. so it's best to show the restore UI and not redirect to the dashboard.
This commit is contained in:
@@ -10,7 +10,6 @@ exports = module.exports = {
|
||||
isRebootRequired,
|
||||
|
||||
onActivated,
|
||||
onRestored,
|
||||
|
||||
setupDnsAndCert,
|
||||
|
||||
@@ -28,7 +27,6 @@ const apps = require('./apps.js'),
|
||||
assert = require('assert'),
|
||||
AuditSource = require('./auditsource.js'),
|
||||
backups = require('./backups.js'),
|
||||
backuptask = require('./backuptask.js'),
|
||||
BoxError = require('./boxerror.js'),
|
||||
branding = require('./branding.js'),
|
||||
constants = require('./constants.js'),
|
||||
@@ -85,24 +83,6 @@ async function onActivated(options) {
|
||||
await reverseProxy.writeDefaultConfig({ activated :true });
|
||||
}
|
||||
|
||||
async function onRestored(options) {
|
||||
assert.strictEqual(typeof options, 'object');
|
||||
|
||||
debug('onRestored: downloading mail');
|
||||
|
||||
const [error, results] = await safe(backups.getByIdentifierAndStatePaged(backups.BACKUP_IDENTIFIER_MAIL, backups.BACKUP_STATE_NORMAL, 1, 1));
|
||||
if (error || results.length == 0) {
|
||||
debug('startMail: could not find backup to restore', error, results);
|
||||
} else {
|
||||
debug(`startMail: downloading backup ${results[0].id}`);
|
||||
const restoreConfig = { backupId: results[0].id, backupFormat: results[0].format };
|
||||
// have to wait for download before starting mail container because we download as non-root user
|
||||
await backuptask.downloadMail(restoreConfig, (progress) => debug(`startMail: ${progress.message}`));
|
||||
}
|
||||
|
||||
await onActivated(options);
|
||||
}
|
||||
|
||||
async function notifyUpdate() {
|
||||
const version = safe.fs.readFileSync(paths.VERSION_FILE, 'utf8');
|
||||
if (version === constants.VERSION) return;
|
||||
|
||||
Reference in New Issue
Block a user