#20844: Fixing case sensitivity of enable command

Work Item: 20844
This commit is contained in:
jasperd
2014-08-08 12:12:48 -07:00
committed by Sebastien Ros
parent 084c40ec6e
commit 91766c486a
2 changed files with 7 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using Orchard.Commands;
using Orchard.Environment.Descriptor.Models;
@@ -57,11 +58,11 @@ namespace Orchard.Modules.Commands {
[CommandName("feature enable")]
public void Enable(params string[] featureNames) {
Context.Output.WriteLine(T("Enabling features {0}", string.Join(",", featureNames)));
bool listAvailableFeatures = false;
List<string> featuresToEnable = new List<string>();
string[] availableFeatures = _featureManager.GetAvailableFeatures().Select(x => x.Id).ToArray();
var listAvailableFeatures = false;
var featuresToEnable = new List<string>();
var availableFeatures = _featureManager.GetAvailableFeatures().Select(x => x.Id).OrderBy(x => x).ToArray();
foreach (var featureName in featureNames) {
if (availableFeatures.Contains(featureName)) {
if (availableFeatures.Contains(featureName, StringComparer.OrdinalIgnoreCase)) {
featuresToEnable.Add(featureName);
}
else {

View File

@@ -92,7 +92,7 @@ namespace Orchard.Modules.Services {
/// <param name="force">Boolean parameter indicating if the feature should disable the features which depend on it if required or fail otherwise.</param>
public void DisableFeatures(IEnumerable<string> featureIds, bool force) {
foreach (string featureId in _featureManager.DisableFeatures(featureIds, force)) {
var featureName = _featureManager.GetAvailableFeatures().Where(f => f.Id == featureId).First().Name;
var featureName = _featureManager.GetAvailableFeatures().Single(f => f.Id.Equals(featureId, StringComparison.OrdinalIgnoreCase)).Name;
Services.Notifier.Information(T("{0} was disabled", featureName));
}
}