mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#20374: Fixing that tenant suspend/restart didn't take effect until an app restart
Work Item: 20374
This commit is contained in:
@@ -260,6 +260,10 @@ namespace Orchard.Environment {
|
||||
// look for the associated shell context
|
||||
var shellContext = _shellContexts.FirstOrDefault(c => c.Settings.Name == settings.Name);
|
||||
|
||||
if (shellContext == null && settings.State == TenantState.Disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// is this is a new tenant ? or is it a tenant waiting for setup ?
|
||||
if (shellContext == null || settings.State == TenantState.Uninitialized) {
|
||||
// create the Shell
|
||||
@@ -268,6 +272,14 @@ namespace Orchard.Environment {
|
||||
// activate the Shell
|
||||
ActivateShell(context);
|
||||
}
|
||||
// terminate the shell if the tenant was disabled
|
||||
else if (settings.State == TenantState.Disabled) {
|
||||
shellContext.Shell.Terminate();
|
||||
shellContext.LifetimeScope.Dispose();
|
||||
_runningShellTable.Remove(settings);
|
||||
|
||||
_shellContexts = _shellContexts.Where(shell => shell.Settings.Name != settings.Name);
|
||||
}
|
||||
// reload the shell as its settings have changed
|
||||
else {
|
||||
// dispose previous context
|
||||
|
@@ -101,6 +101,8 @@ namespace Orchard.Environment {
|
||||
// will not be mapped to routes coming from orchard
|
||||
_fallback = null;
|
||||
}
|
||||
|
||||
_shellsByHostAndPrefix.Clear();
|
||||
}
|
||||
|
||||
public ShellSettings Match(HttpContextBase httpContext) {
|
||||
|
Reference in New Issue
Block a user