#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
@@ -71,9 +71,6 @@ namespace Orchard.Data {
} }
private void StoreConfiguration(ConfigurationCache cache) { private void StoreConfiguration(ConfigurationCache cache) {
if (!_hostEnvironment.IsFullTrust)
return;
var pathName = GetPathName(_shellSettings.Name); var pathName = GetPathName(_shellSettings.Name);
try { try {
@@ -93,9 +90,6 @@ namespace Orchard.Data {
} }
private ConfigurationCache ReadConfiguration(string hash) { private ConfigurationCache ReadConfiguration(string hash) {
if (!_hostEnvironment.IsFullTrust)
return null;
var pathName = GetPathName(_shellSettings.Name); var pathName = GetPathName(_shellSettings.Name);
if (!_appDataFolder.FileExists(pathName)) if (!_appDataFolder.FileExists(pathName))
-3
View File
@@ -84,9 +84,6 @@ namespace Orchard.Data {
private ISessionFactory BuildSessionFactory() { private ISessionFactory BuildSessionFactory() {
Logger.Debug("Building session factory"); Logger.Debug("Building session factory");
if (!_hostEnvironment.IsFullTrust)
NHibernate.Cfg.Environment.UseReflectionOptimizer = false;
Configuration config = GetConfiguration(); Configuration config = GetConfiguration();
var result = config.BuildSessionFactory(); var result = config.BuildSessionFactory();
Logger.Debug("Done building session factory"); Logger.Debug("Done building session factory");
@@ -25,21 +25,16 @@ namespace Orchard.Environment {
public ILogger Logger { get; set; } public ILogger Logger { get; set; }
public override void RestartAppDomain() { public override void RestartAppDomain() {
if (IsFullTrust) { bool success = TryWriteBinFolder() || TryWriteWebConfig();
HttpRuntime.UnloadAppDomain();
}
else {
bool success = TryWriteBinFolder() || TryWriteWebConfig();
if (!success) { if (!success) {
throw new OrchardException( throw new OrchardException(
T("Orchard needs to be restarted due to a configuration change, but was unable to do so.\r\n" + 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" + "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" + "- 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 '{0}' folder, or\r\n" +
"- give the application write access to the '{1}' file.", "- give the application write access to the '{1}' file.",
HostRestartPath, WebConfigPath)); HostRestartPath, WebConfigPath));
}
} }
// If setting up extensions/modules requires an AppDomain restart, it's very unlikely the // If setting up extensions/modules requires an AppDomain restart, it's very unlikely the
@@ -5,10 +5,6 @@ using System.Web.Hosting;
namespace Orchard.Environment { namespace Orchard.Environment {
public abstract class HostEnvironment : IHostEnvironment { public abstract class HostEnvironment : IHostEnvironment {
public bool IsFullTrust {
get { return AppDomain.CurrentDomain.IsHomogenous && AppDomain.CurrentDomain.IsFullyTrusted; }
}
public string MapPath(string virtualPath) { public string MapPath(string virtualPath) {
return HostingEnvironment.MapPath(virtualPath); return HostingEnvironment.MapPath(virtualPath);
} }
@@ -3,7 +3,6 @@
/// Abstraction of the running environment /// Abstraction of the running environment
/// </summary> /// </summary>
public interface IHostEnvironment { public interface IHostEnvironment {
bool IsFullTrust { get; }
string MapPath(string virtualPath); string MapPath(string virtualPath);
bool IsAssemblyLoaded(string name); bool IsAssemblyLoaded(string name);
+1 -1
View File
@@ -13,7 +13,7 @@ namespace Orchard.Logging {
: this(ConfigurationManager.AppSettings["log4net.Config"], hostEnvironment) { } : this(ConfigurationManager.AppSettings["log4net.Config"], hostEnvironment) { }
public OrchardLog4netFactory(string configFilename, IHostEnvironment 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 // Only monitor configuration file in full trust
XmlConfigurator.ConfigureAndWatch(GetConfigFile(configFilename)); XmlConfigurator.ConfigureAndWatch(GetConfigFile(configFilename));
_isFileWatched = true; _isFileWatched = true;