Resetting shell state in case of an unexpected exception during setup.

This commit is contained in:
Sipke Schoorstra
2015-09-10 23:37:10 +01:00
parent e97d54e600
commit 8308d66d66

View File

@@ -69,6 +69,17 @@ namespace Orchard.Setup.Services {
} }
public string Setup(SetupContext context) { public string Setup(SetupContext context) {
var initialState = _shellSettings.State;
try {
return SetupInternal(context);
}
catch {
_shellSettings.State = initialState;
throw;
}
}
private string SetupInternal(SetupContext context) {
string executionId; string executionId;
Logger.Information("Running setup for tenant '{0}'.", _shellSettings.Name); Logger.Information("Running setup for tenant '{0}'.", _shellSettings.Name);
@@ -175,7 +186,6 @@ namespace Orchard.Setup.Services {
} }
_shellSettingsManager.SaveSettings(shellSettings); _shellSettingsManager.SaveSettings(shellSettings);
return executionId; return executionId;
} }