mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#17923: Modules from ~/Bin and ~/Core have higher priority
Because of the way ASP.NET BuildManager works(*), we can't enable dynamic compilation of a module if the module is already present in ~/bin. (*) When invoking the compiler, BuildManager automatically adds references to all assemblies present in ~/bin. So, if you have module "X" in "~/bin", there is no way to enable dynamic compilation of module "X" by compiling "X.csproj", as there will be tons of compilation errors with equivalent types defined in multiple assemblies. --HG-- branch : 1.x
This commit is contained in:
@@ -247,7 +247,20 @@ namespace Orchard.Environment.Extensions {
|
||||
}
|
||||
|
||||
private IEnumerable<ExtensionProbeEntry> SortExtensionProbeEntries(IEnumerable<ExtensionProbeEntry> entries, ConcurrentDictionary<string, DateTime> virtualPathModficationDates) {
|
||||
return entries
|
||||
// All "entries" are for the same extension ID, so we just need to filter/sort them by priority+ modification dates.
|
||||
var groupByPriority = entries
|
||||
.GroupBy(entry => entry.Priority)
|
||||
.OrderByDescending(g => g.Key);
|
||||
|
||||
// Select highest priority group with at least one item
|
||||
var firstNonEmptyGroup = groupByPriority.FirstOrDefault(g => g.Count() >= 1) ?? Enumerable.Empty<ExtensionProbeEntry>();
|
||||
|
||||
// No need for further sorting if only 1 item found
|
||||
if (firstNonEmptyGroup.Count() <= 1)
|
||||
return firstNonEmptyGroup;
|
||||
|
||||
// Sort by last modification date/loader order
|
||||
return firstNonEmptyGroup
|
||||
.OrderByDescending(probe => GetVirtualPathDepedenciesModificationTimeUtc(virtualPathModficationDates, probe))
|
||||
.ThenBy(probe => probe.Loader.Order)
|
||||
.ToList();
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
return new ExtensionProbeEntry {
|
||||
Descriptor = descriptor,
|
||||
Loader = this,
|
||||
Priority = 100, // Higher priority because assemblies in ~/bin always take precedence
|
||||
VirtualPath = "~/Core/" + descriptor.Id,
|
||||
VirtualPathDependencies = Enumerable.Empty<string>(),
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
public class ExtensionProbeEntry {
|
||||
public ExtensionDescriptor Descriptor { get; set; }
|
||||
public IExtensionLoader Loader { get; set; }
|
||||
public int Priority { get; set; }
|
||||
public string VirtualPath { get; set; }
|
||||
public IEnumerable<string> VirtualPathDependencies { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.FileSystems.Dependencies;
|
||||
@@ -59,6 +60,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
return new ExtensionProbeEntry {
|
||||
Descriptor = descriptor,
|
||||
Loader = this,
|
||||
Priority = 100, // Higher priority because assemblies in ~/bin always take precedence
|
||||
VirtualPath = assemblyPath,
|
||||
VirtualPathDependencies = new[] { assemblyPath },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user