mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Resetting shell state in case of an unexpected exception during setup.
This commit is contained in:
@@ -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);
|
||||||
@@ -96,7 +107,7 @@ namespace Orchard.Setup.Services {
|
|||||||
shellSettings.DataConnectionString = context.DatabaseConnectionString;
|
shellSettings.DataConnectionString = context.DatabaseConnectionString;
|
||||||
shellSettings.DataTablePrefix = context.DatabaseTablePrefix;
|
shellSettings.DataTablePrefix = context.DatabaseTablePrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
shellSettings.EncryptionAlgorithm = "AES";
|
shellSettings.EncryptionAlgorithm = "AES";
|
||||||
|
|
||||||
// Randomly generated key.
|
// Randomly generated key.
|
||||||
@@ -173,9 +184,8 @@ namespace Orchard.Setup.Services {
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_shellSettingsManager.SaveSettings(shellSettings);
|
|
||||||
|
|
||||||
|
_shellSettingsManager.SaveSettings(shellSettings);
|
||||||
return executionId;
|
return executionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user