#20367: Removing IHostEnvironment.IsFullTrust since only full trust is supported any way.

Work Item: 20367
This commit is contained in:
Lombiq
2015-01-26 20:32:06 +01:00
committed by Zoltán Lehóczky
parent 8dae8f3d5b
commit a14ebfd555
6 changed files with 10 additions and 29 deletions

View File

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

View File

@@ -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");

View File

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

View File

@@ -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);
}

View File

@@ -3,7 +3,6 @@
/// Abstraction of the running environment
/// </summary>
public interface IHostEnvironment {
bool IsFullTrust { get; }
string MapPath(string virtualPath);
bool IsAssemblyLoaded(string name);

View File

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