mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#20367: Removing IHostEnvironment.IsFullTrust since only full trust is supported any way.
Work Item: 20367
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
/// Abstraction of the running environment
|
||||
/// </summary>
|
||||
public interface IHostEnvironment {
|
||||
bool IsFullTrust { get; }
|
||||
string MapPath(string virtualPath);
|
||||
|
||||
bool IsAssemblyLoaded(string name);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user