Use task API for app restore

This commit is contained in:
Girish Ramakrishnan
2019-08-26 22:03:10 -07:00
parent ff11c38169
commit f45b61d95c
2 changed files with 6 additions and 3 deletions
+5 -3
View File
@@ -1045,11 +1045,13 @@ function restore(appId, data, auditSource, callback) {
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new AppsError(AppsError.BAD_STATE)); // might be a bad guess if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new AppsError(AppsError.BAD_STATE)); // might be a bad guess
if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error)); if (error) return callback(new AppsError(AppsError.INTERNAL_ERROR, error));
taskmanager.restartAppTask(appId); startAppTask(appId, function (error) {
if (error) return callback(error);
eventlog.add(eventlog.ACTION_APP_RESTORE, auditSource, { app: app, backupId: backupInfo.id, fromManifest: app.manifest, toManifest: backupInfo.manifest }); eventlog.add(eventlog.ACTION_APP_RESTORE, auditSource, { app: app, backupId: backupInfo.id, fromManifest: app.manifest, toManifest: backupInfo.manifest });
callback(null); callback(null);
});
}); });
}); });
}); });
+1
View File
@@ -967,6 +967,7 @@ function run(appId, progressCallback, callback) {
case appdb.ISTATE_PENDING_CONFIGURE: return configure(app, progressCallback, callback); case appdb.ISTATE_PENDING_CONFIGURE: return configure(app, progressCallback, callback);
case appdb.ISTATE_PENDING_UNINSTALL: return uninstall(app, progressCallback, callback); case appdb.ISTATE_PENDING_UNINSTALL: return uninstall(app, progressCallback, callback);
case appdb.ISTATE_PENDING_CLONE: return install(app, progressCallback, callback); case appdb.ISTATE_PENDING_CLONE: return install(app, progressCallback, callback);
case appdb.ISTATE_PENDING_RESTORE: return install(app, progressCallback, callback);
default: default:
debugApp(app, 'apptask launched with invalid command'); debugApp(app, 'apptask launched with invalid command');