From a14ebfd555a88cd5c177ca16299889c619598997 Mon Sep 17 00:00:00 2001 From: Lombiq Date: Mon, 26 Jan 2015 20:32:06 +0100 Subject: [PATCH] #20367: Removing IHostEnvironment.IsFullTrust since only full trust is supported any way. Work Item: 20367 --- src/Orchard/Data/SessionConfigurationCache.cs | 6 ----- src/Orchard/Data/SessionFactoryHolder.cs | 3 --- .../Environment/DefaultHostEnvironment.cs | 23 ++++++++----------- src/Orchard/Environment/HostEnvironment.cs | 4 ---- src/Orchard/Environment/IHostEnvironment.cs | 1 - src/Orchard/Logging/OrchardLog4netFactory.cs | 2 +- 6 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/Orchard/Data/SessionConfigurationCache.cs b/src/Orchard/Data/SessionConfigurationCache.cs index f83024905..037f80801 100644 --- a/src/Orchard/Data/SessionConfigurationCache.cs +++ b/src/Orchard/Data/SessionConfigurationCache.cs @@ -71,9 +71,6 @@ namespace Orchard.Data { } private void StoreConfiguration(ConfigurationCache cache) { - if (!_hostEnvironment.IsFullTrust) - return; - var pathName = GetPathName(_shellSettings.Name); try { @@ -93,9 +90,6 @@ namespace Orchard.Data { } private ConfigurationCache ReadConfiguration(string hash) { - if (!_hostEnvironment.IsFullTrust) - return null; - var pathName = GetPathName(_shellSettings.Name); if (!_appDataFolder.FileExists(pathName)) diff --git a/src/Orchard/Data/SessionFactoryHolder.cs b/src/Orchard/Data/SessionFactoryHolder.cs index 721b35a3e..130329058 100644 --- a/src/Orchard/Data/SessionFactoryHolder.cs +++ b/src/Orchard/Data/SessionFactoryHolder.cs @@ -84,9 +84,6 @@ namespace Orchard.Data { private ISessionFactory BuildSessionFactory() { Logger.Debug("Building session factory"); - if (!_hostEnvironment.IsFullTrust) - NHibernate.Cfg.Environment.UseReflectionOptimizer = false; - Configuration config = GetConfiguration(); var result = config.BuildSessionFactory(); Logger.Debug("Done building session factory"); diff --git a/src/Orchard/Environment/DefaultHostEnvironment.cs b/src/Orchard/Environment/DefaultHostEnvironment.cs index 6e140ff61..37d6e6c49 100644 --- a/src/Orchard/Environment/DefaultHostEnvironment.cs +++ b/src/Orchard/Environment/DefaultHostEnvironment.cs @@ -25,21 +25,16 @@ namespace Orchard.Environment { public ILogger Logger { get; set; } public override void RestartAppDomain() { - if (IsFullTrust) { - HttpRuntime.UnloadAppDomain(); - } - else { - bool success = TryWriteBinFolder() || TryWriteWebConfig(); + bool success = TryWriteBinFolder() || TryWriteWebConfig(); - if (!success) { - throw new OrchardException( - T("Orchard needs to be restarted due to a configuration change, but was unable to do so.\r\n" + - "To prevent this issue in the future, a change to the web server configuration is required:\r\n" + - "- run the application in a full trust environment, or\r\n" + - "- give the application write access to the '{0}' folder, or\r\n" + - "- give the application write access to the '{1}' file.", - HostRestartPath, WebConfigPath)); - } + if (!success) { + throw new OrchardException( + T("Orchard needs to be restarted due to a configuration change, but was unable to do so.\r\n" + + "To prevent this issue in the future, a change to the web server configuration is required:\r\n" + + "- run the application in a full trust environment, or\r\n" + + "- give the application write access to the '{0}' folder, or\r\n" + + "- give the application write access to the '{1}' file.", + HostRestartPath, WebConfigPath)); } // If setting up extensions/modules requires an AppDomain restart, it's very unlikely the diff --git a/src/Orchard/Environment/HostEnvironment.cs b/src/Orchard/Environment/HostEnvironment.cs index e185944fa..e4f30d5ae 100644 --- a/src/Orchard/Environment/HostEnvironment.cs +++ b/src/Orchard/Environment/HostEnvironment.cs @@ -5,10 +5,6 @@ using System.Web.Hosting; namespace Orchard.Environment { public abstract class HostEnvironment : IHostEnvironment { - public bool IsFullTrust { - get { return AppDomain.CurrentDomain.IsHomogenous && AppDomain.CurrentDomain.IsFullyTrusted; } - } - public string MapPath(string virtualPath) { return HostingEnvironment.MapPath(virtualPath); } diff --git a/src/Orchard/Environment/IHostEnvironment.cs b/src/Orchard/Environment/IHostEnvironment.cs index 563b96475..69874acde 100644 --- a/src/Orchard/Environment/IHostEnvironment.cs +++ b/src/Orchard/Environment/IHostEnvironment.cs @@ -3,7 +3,6 @@ /// Abstraction of the running environment /// public interface IHostEnvironment { - bool IsFullTrust { get; } string MapPath(string virtualPath); bool IsAssemblyLoaded(string name); diff --git a/src/Orchard/Logging/OrchardLog4netFactory.cs b/src/Orchard/Logging/OrchardLog4netFactory.cs index 050dddd90..47870182c 100644 --- a/src/Orchard/Logging/OrchardLog4netFactory.cs +++ b/src/Orchard/Logging/OrchardLog4netFactory.cs @@ -13,7 +13,7 @@ namespace Orchard.Logging { : this(ConfigurationManager.AppSettings["log4net.Config"], hostEnvironment) { } public OrchardLog4netFactory(string configFilename, IHostEnvironment hostEnvironment) { - if (!_isFileWatched && !string.IsNullOrWhiteSpace(configFilename) && hostEnvironment.IsFullTrust) { + if (!_isFileWatched && !string.IsNullOrWhiteSpace(configFilename)) { // Only monitor configuration file in full trust XmlConfigurator.ConfigureAndWatch(GetConfigFile(configFilename)); _isFileWatched = true;