mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
Added a "Disabled" option for all extension loaders
--HG-- branch : dev
This commit is contained in:
@@ -20,10 +20,14 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
public bool Disabled { get; set; }
|
||||
|
||||
public override int Order { get { return 10; } }
|
||||
|
||||
public override ExtensionProbeEntry Probe(ExtensionDescriptor descriptor) {
|
||||
if (Disabled)
|
||||
return null;
|
||||
|
||||
if (descriptor.Location == "~/Core") {
|
||||
return new ExtensionProbeEntry {
|
||||
Descriptor = descriptor,
|
||||
@@ -36,6 +40,9 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
}
|
||||
|
||||
protected override ExtensionEntry LoadWorker(ExtensionDescriptor descriptor) {
|
||||
if (Disabled)
|
||||
return null;
|
||||
|
||||
//Logger.Information("Loading extension \"{0}\"", descriptor.Name);
|
||||
|
||||
var assembly = _assemblyLoader.Load(CoreAssemblyName);
|
||||
|
@@ -36,6 +36,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
public bool Disabled { get; set; }
|
||||
|
||||
public override int Order { get { return 30; } }
|
||||
|
||||
@@ -169,6 +170,9 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
}
|
||||
|
||||
public override ExtensionProbeEntry Probe(ExtensionDescriptor descriptor) {
|
||||
if (Disabled)
|
||||
return null;
|
||||
|
||||
var assemblyPath = GetAssemblyPath(descriptor);
|
||||
if (assemblyPath == null)
|
||||
return null;
|
||||
@@ -186,6 +190,9 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
}
|
||||
|
||||
protected override ExtensionEntry LoadWorker(ExtensionDescriptor descriptor) {
|
||||
if (Disabled)
|
||||
return null;
|
||||
|
||||
var assembly = _assemblyProbingFolder.LoadAssembly(descriptor.Id);
|
||||
if (assembly == null)
|
||||
return null;
|
||||
|
@@ -16,11 +16,15 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
public bool Disabled { get; set; }
|
||||
|
||||
public override int Order { get { return 10; } }
|
||||
|
||||
public override ExtensionProbeEntry Probe(ExtensionDescriptor descriptor) {
|
||||
if ( descriptor.Location == "~/Themes") {
|
||||
if (Disabled)
|
||||
return null;
|
||||
|
||||
if (descriptor.Location == "~/Themes") {
|
||||
string projectPath = _virtualPathProvider.Combine(descriptor.Location, descriptor.Id,
|
||||
descriptor.Id + ".csproj");
|
||||
|
||||
@@ -48,6 +52,9 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
}
|
||||
|
||||
protected override ExtensionEntry LoadWorker(ExtensionDescriptor descriptor) {
|
||||
if (Disabled)
|
||||
return null;
|
||||
|
||||
return new ExtensionEntry {
|
||||
Descriptor = descriptor,
|
||||
Assembly = GetType().Assembly,
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using System.IO;
|
||||
using System.Web.Hosting;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.FileSystems.Dependencies;
|
||||
using Orchard.FileSystems.VirtualPath;
|
||||
@@ -22,6 +21,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
public bool Disabled { get; set; }
|
||||
|
||||
public override int Order { get { return 20; } }
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
}
|
||||
|
||||
public override ExtensionProbeEntry Probe(ExtensionDescriptor descriptor) {
|
||||
if (HostingEnvironment.IsHosted == false)
|
||||
if (Disabled)
|
||||
return null;
|
||||
|
||||
var assembly = _buildManager.GetReferencedAssembly(descriptor.Id);
|
||||
@@ -62,7 +62,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
}
|
||||
|
||||
protected override ExtensionEntry LoadWorker(ExtensionDescriptor descriptor) {
|
||||
if (HostingEnvironment.IsHosted == false)
|
||||
if (Disabled)
|
||||
return null;
|
||||
|
||||
var assembly = _buildManager.GetReferencedAssembly(descriptor.Id);
|
||||
|
Reference in New Issue
Block a user