Make force update as task arg

This commit is contained in:
Girish Ramakrishnan
2019-08-29 10:59:05 -07:00
parent f3008064e4
commit c98f625c4c
3 changed files with 7 additions and 9 deletions
+2 -6
View File
@@ -715,8 +715,6 @@ function update(app, updateConfig, progressCallback, callback) {
// FIXME: this does not handle option changes (like multipleDatabases)
var unusedAddons = _.omit(app.manifest.addons, Object.keys(updateConfig.manifest.addons));
const FORCED_UPDATE = (app.installationState === appdb.ISTATE_PENDING_FORCE_UPDATE);
async.series([
// this protects against the theoretical possibility of an app being marked for update from
// a previous version of box code
@@ -724,7 +722,7 @@ function update(app, updateConfig, progressCallback, callback) {
verifyManifest.bind(null, updateConfig.manifest),
function (next) {
if (FORCED_UPDATE) return next(null);
if (updateConfig.skipBackup) return next(null);
async.series([
progressCallback.bind(null, { percent: 15, message: 'Backing up app' }),
@@ -810,8 +808,7 @@ function update(app, updateConfig, progressCallback, callback) {
debugApp(app, 'Error updating app: %s', error);
updateApp(app, { installationState: appdb.ISTATE_ERROR, errorMessage: error.message, updateTime: new Date() }, callback.bind(null, error));
} else {
// do not spam the notifcation view
if (FORCED_UPDATE) return callback();
if (updateConfig.skipNotification) return callback();
eventlog.add(eventlog.ACTION_APP_UPDATE_FINISH, auditsource.APP_TASK, { app: app, success: true }, callback);
}
@@ -929,7 +926,6 @@ function run(appId, args, progressCallback, callback) {
case appdb.ISTATE_PENDING_CLONE: return install(app, args.restoreConfig || {}, progressCallback, callback);
case appdb.ISTATE_PENDING_RESTORE: return install(app, args.restoreConfig || {}, progressCallback, callback);
case appdb.ISTATE_PENDING_UPDATE: return update(app, args.updateConfig, progressCallback, callback);
case appdb.ISTATE_PENDING_FORCE_UPDATE: return update(app, args.updateConfig, progressCallback, callback);
case appdb.ISTATE_PENDING_BACKUP: return backup(app, progressCallback, callback);
case appdb.ISTATE_INSTALLED: return handleRunCommand(app, progressCallback, callback);