#20374: Fixing that tenant suspend/restart didn't take effect until an app restart

Work Item: 20374
This commit is contained in:
Lombiq
2014-01-18 22:40:53 +01:00
committed by Zoltán Lehóczky
parent 1eecc1ab4d
commit 97026dd0fa
2 changed files with 14 additions and 0 deletions

View File

@@ -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

View File

@@ -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) {