mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#18328: Fixing modules directory case sensitivity
Work Item: 18328 --HG-- branch : 1.x
This commit is contained in:
@@ -72,7 +72,7 @@ namespace Orchard.Modules.Services {
|
|||||||
/// <param name="force">Boolean parameter indicating if the feature should enable it's dependencies if required or fail otherwise.</param>
|
/// <param name="force">Boolean parameter indicating if the feature should enable it's dependencies if required or fail otherwise.</param>
|
||||||
public void EnableFeatures(IEnumerable<string> featureIds, bool force) {
|
public void EnableFeatures(IEnumerable<string> featureIds, bool force) {
|
||||||
foreach (string featureId in _featureManager.EnableFeatures(featureIds, force)) {
|
foreach (string featureId in _featureManager.EnableFeatures(featureIds, force)) {
|
||||||
var featureName = _featureManager.GetAvailableFeatures().Where(f => f.Id == featureId).First().Name;
|
var featureName = _featureManager.GetAvailableFeatures().First(f => f.Id.Equals(featureId, StringComparison.OrdinalIgnoreCase)).Name;
|
||||||
Services.Notifier.Information(T("{0} was enabled", featureName));
|
Services.Notifier.Information(T("{0} was enabled", featureName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,16 +49,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dependencies = (from d in feature.Descriptor.Dependencies
|
var dependencies = (from d in feature.Descriptor.Dependencies
|
||||||
select (from f in Model.Features where f.Descriptor.Id == d select f).SingleOrDefault()).Where(f => f != null).OrderBy(f => f.Descriptor.Name);
|
select (from f in Model.Features where f.Descriptor.Id.Equals(d, StringComparison.OrdinalIgnoreCase) select f).SingleOrDefault()).Where(f => f != null).OrderBy(f => f.Descriptor.Name);
|
||||||
var missingDependencies = feature.Descriptor.Dependencies
|
var missingDependencies = feature.Descriptor.Dependencies
|
||||||
.Where(d => !Model.Features.Any(f => f.Descriptor.Id == d));
|
.Where(d => !Model.Features.Any(f => f.Descriptor.Id.Equals(d, StringComparison.OrdinalIgnoreCase)));
|
||||||
showDisable = categoryName.ToString() != "Core";
|
showDisable = categoryName.ToString() != "Core";
|
||||||
showEnable = missingDependencies.Count() == 0 && feature.Descriptor.Id != "Orchard.Setup";
|
showEnable = !missingDependencies.Any() && feature.Descriptor.Id != "Orchard.Setup";
|
||||||
<li class="@featureClassName" id="@featureId" title="@T("{0} is {1}", Html.AttributeEncode(featureName), featureState)">
|
<li class="@featureClassName" id="@featureId" title="@T("{0} is {1}", Html.AttributeEncode(featureName), featureState)">
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
<div class="properties">
|
<div class="properties">
|
||||||
<h3>@featureName</h3>
|
<h3>@featureName</h3>
|
||||||
<p class="description">@feature.Descriptor.Description</p>@if (feature.Descriptor.Dependencies != null && feature.Descriptor.Dependencies.Any()) {
|
<p class="description">@feature.Descriptor.Description</p>
|
||||||
|
@if (feature.Descriptor.Dependencies != null && feature.Descriptor.Dependencies.Any()) {
|
||||||
<div class="dependencies">
|
<div class="dependencies">
|
||||||
<h4>@T("Depends on:")</h4>
|
<h4>@T("Depends on:")</h4>
|
||||||
@Html.UnorderedList(dependencies,
|
@Html.UnorderedList(dependencies,
|
||||||
|
|||||||
@@ -109,13 +109,13 @@ namespace Orchard.Environment.Features {
|
|||||||
|
|
||||||
IDictionary<FeatureDescriptor, bool> availableFeatures = GetAvailableFeatures()
|
IDictionary<FeatureDescriptor, bool> availableFeatures = GetAvailableFeatures()
|
||||||
.ToDictionary(featureDescriptor => featureDescriptor,
|
.ToDictionary(featureDescriptor => featureDescriptor,
|
||||||
featureDescriptor => enabledFeatures.FirstOrDefault(shellFeature => shellFeature.Name == featureDescriptor.Id) != null);
|
featureDescriptor => enabledFeatures.FirstOrDefault(shellFeature => shellFeature.Name.Equals(featureDescriptor.Id)) != null);
|
||||||
|
|
||||||
IEnumerable<string> featuresToDisable = featureIds
|
IEnumerable<string> featuresToDisable = featureIds
|
||||||
.Select(featureId => DisableFeature(featureId, availableFeatures, force)).ToList()
|
.Select(featureId => DisableFeature(featureId, availableFeatures, force)).ToList()
|
||||||
.SelectMany(ies => ies.Select(s => s));
|
.SelectMany(ies => ies.Select(s => s));
|
||||||
|
|
||||||
if (featuresToDisable.Count() > 0) {
|
if (featuresToDisable.Any()) {
|
||||||
foreach (string featureId in featuresToDisable) {
|
foreach (string featureId in featuresToDisable) {
|
||||||
string id = featureId;
|
string id = featureId;
|
||||||
|
|
||||||
@@ -141,11 +141,11 @@ namespace Orchard.Environment.Features {
|
|||||||
var getDisabledDependencies =
|
var getDisabledDependencies =
|
||||||
new Func<string, IDictionary<FeatureDescriptor, bool>, IDictionary<FeatureDescriptor, bool>>(
|
new Func<string, IDictionary<FeatureDescriptor, bool>, IDictionary<FeatureDescriptor, bool>>(
|
||||||
(currentFeatureId, featuresState) => {
|
(currentFeatureId, featuresState) => {
|
||||||
KeyValuePair<FeatureDescriptor, bool> feature = featuresState.Single(featureState => featureState.Key.Id == currentFeatureId);
|
KeyValuePair<FeatureDescriptor, bool> feature = featuresState.Single(featureState => featureState.Key.Id.Equals(currentFeatureId, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
// Retrieve disabled dependencies for the current feature
|
// Retrieve disabled dependencies for the current feature
|
||||||
return feature.Key.Dependencies
|
return feature.Key.Dependencies
|
||||||
.Select(fId => featuresState.Single(featureState => featureState.Key.Id == fId))
|
.Select(fId => featuresState.Single(featureState => featureState.Key.Id.Equals(fId, StringComparison.OrdinalIgnoreCase)))
|
||||||
.Where(featureState => !featureState.Value)
|
.Where(featureState => !featureState.Value)
|
||||||
.ToDictionary(f => f.Key, f => f.Value);
|
.ToDictionary(f => f.Key, f => f.Value);
|
||||||
});
|
});
|
||||||
@@ -173,7 +173,7 @@ namespace Orchard.Environment.Features {
|
|||||||
private IEnumerable<string> DisableFeature(string featureId, IDictionary<FeatureDescriptor, bool> availableFeatures, bool force) {
|
private IEnumerable<string> DisableFeature(string featureId, IDictionary<FeatureDescriptor, bool> availableFeatures, bool force) {
|
||||||
var getEnabledDependants =
|
var getEnabledDependants =
|
||||||
new Func<string, IDictionary<FeatureDescriptor, bool>, IDictionary<FeatureDescriptor, bool>>(
|
new Func<string, IDictionary<FeatureDescriptor, bool>, IDictionary<FeatureDescriptor, bool>>(
|
||||||
(currentFeatureId, fs) => fs.Where(f => f.Value && f.Key.Dependencies != null && f.Key.Dependencies.Contains(currentFeatureId))
|
(currentFeatureId, fs) => fs.Where(f => f.Value && f.Key.Dependencies != null && f.Key.Dependencies.Select(s => s.ToLowerInvariant()).Contains(currentFeatureId.ToLowerInvariant()))
|
||||||
.ToDictionary(f => f.Key, f => f.Value));
|
.ToDictionary(f => f.Key, f => f.Value));
|
||||||
|
|
||||||
IEnumerable<string> featuresToDisable = GetAffectedFeatures(featureId, availableFeatures, getEnabledDependants);
|
IEnumerable<string> featuresToDisable = GetAffectedFeatures(featureId, availableFeatures, getEnabledDependants);
|
||||||
|
|||||||
Reference in New Issue
Block a user