mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-24 04:47:07 +08:00
Display an error message in command line on app domain restart
With dynamic compilation, it is sometimes necessary to restart the AppDomain. In the command line scenario, instead of restarting the appdomain, we throw an exception with an descriptive error message. --HG-- branch : dev
This commit is contained in:
parent
293cfa91ce
commit
320019b8c6
@ -2,9 +2,16 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Web.Hosting;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Commands {
|
||||
public class CommandHostEnvironment : IHostEnvironment {
|
||||
public CommandHostEnvironment() {
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public bool IsFullTrust {
|
||||
get { return AppDomain.CurrentDomain.IsFullyTrusted; }
|
||||
}
|
||||
@ -18,11 +25,11 @@ namespace Orchard.Commands {
|
||||
}
|
||||
|
||||
public void RestartAppDomain() {
|
||||
//Don't restart AppDomain in command line environment
|
||||
ResetSiteCompilation();
|
||||
}
|
||||
|
||||
public void ResetSiteCompilation() {
|
||||
//Don't restart AppDomain in command line environment
|
||||
throw new OrchardCoreException(T("A change of configuration requires the application to be restarted. Running the command again usually solves this problem."));
|
||||
}
|
||||
}
|
||||
}
|
@ -45,6 +45,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
Logger.Information("ExtensionRemoved: Deleting assembly \"{0}\" from bin directory (AppDomain will restart)", moduleName);
|
||||
File.Delete(_virtualPathProvider.MapPath(assemblyPath));
|
||||
});
|
||||
ctx.RestartAppDomain = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user