#18328: Fixing modules directory case sensitivity

Work Item: 18328

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-01-04 16:32:37 -08:00
parent de31c6a759
commit bbcd00ae8b
3 changed files with 11 additions and 10 deletions

View File

@@ -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>
public void EnableFeatures(IEnumerable<string> featureIds, bool 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));
}
}

View File

@@ -49,16 +49,17 @@
}
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
.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";
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)">
<div class="summary">
<div class="properties">
<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">
<h4>@T("Depends on:")</h4>
@Html.UnorderedList(dependencies,

View File

@@ -109,13 +109,13 @@ namespace Orchard.Environment.Features {
IDictionary<FeatureDescriptor, bool> availableFeatures = GetAvailableFeatures()
.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
.Select(featureId => DisableFeature(featureId, availableFeatures, force)).ToList()
.SelectMany(ies => ies.Select(s => s));
if (featuresToDisable.Count() > 0) {
if (featuresToDisable.Any()) {
foreach (string featureId in featuresToDisable) {
string id = featureId;
@@ -141,11 +141,11 @@ namespace Orchard.Environment.Features {
var getDisabledDependencies =
new Func<string, IDictionary<FeatureDescriptor, bool>, IDictionary<FeatureDescriptor, bool>>(
(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
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)
.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) {
var getEnabledDependants =
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));
IEnumerable<string> featuresToDisable = GetAffectedFeatures(featureId, availableFeatures, getEnabledDependants);