mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 20:13:52 +08:00
Save "dependencies.xml" only if there are changes
--HG-- branch : dev
This commit is contained in:
@@ -44,7 +44,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
Descriptor = descriptor,
|
||||
LastModificationTimeUtc = File.GetLastWriteTimeUtc(assembly.Location),
|
||||
Loader = this,
|
||||
VirtualPath = "~/bin/" + descriptor.Name
|
||||
VirtualPath = _virtualPathProvider.Combine("~/bin", descriptor.Name + ".dll")
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,28 @@ namespace Orchard.FileSystems.Dependencies {
|
||||
}
|
||||
|
||||
public void StoreDescriptors(IEnumerable<DependencyDescriptor> dependencyDescriptors) {
|
||||
WriteDependencies(PersistencePath, dependencyDescriptors);
|
||||
var existingDescriptors = this.Descriptors.OrderBy(d => d.Name);
|
||||
var newDescriptors = dependencyDescriptors.OrderBy(d => d.Name);
|
||||
if (!newDescriptors.SequenceEqual(existingDescriptors, new DependencyDescriptorComparer())) {
|
||||
WriteDependencies(PersistencePath, dependencyDescriptors);
|
||||
}
|
||||
}
|
||||
|
||||
private class DependencyDescriptorComparer : EqualityComparer<DependencyDescriptor> {
|
||||
public override bool Equals(DependencyDescriptor x, DependencyDescriptor y) {
|
||||
return
|
||||
StringComparer.OrdinalIgnoreCase.Equals(x.Name, y.Name) &&
|
||||
StringComparer.OrdinalIgnoreCase.Equals(x.LoaderName, y.LoaderName) &&
|
||||
StringComparer.OrdinalIgnoreCase.Equals(x.VirtualPath, y.VirtualPath);
|
||||
|
||||
}
|
||||
|
||||
public override int GetHashCode(DependencyDescriptor obj) {
|
||||
return
|
||||
StringComparer.OrdinalIgnoreCase.GetHashCode(obj.Name) ^
|
||||
StringComparer.OrdinalIgnoreCase.GetHashCode(obj.LoaderName) ^
|
||||
StringComparer.OrdinalIgnoreCase.GetHashCode(obj.VirtualPath);
|
||||
}
|
||||
}
|
||||
|
||||
public DependencyDescriptor GetDescriptor(string moduleName) {
|
||||
|
||||
Reference in New Issue
Block a user