#17898: Enabling dependent modules in Recipes from the gallery

Work Item: 17898

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-01-05 11:21:34 -08:00
parent 594019e0f7
commit 07dc0197ad
4 changed files with 28 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Web.Hosting;
using System.Web.Mvc;
using System.Xml.Linq;
using NuGet;
using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions.Models;
@@ -227,8 +228,17 @@ namespace Orchard.Packaging.Controllers {
.Where(feature => feature.Enable)
.Select(feature => feature.FeatureDescriptor.Id);
// Enable the features and its dependencies
_moduleService.EnableFeatures(featureIds, true);
// Enable the features and its dependencies using recipes, so that they are run after the module's recipes
var recipe = new Recipe {
RecipeSteps = featureIds.Select(
x => new RecipeStep {
Name = "Feature",
Step = new XElement("Feature", new XAttribute("enable", x))
})
};
_recipeManager.Execute(recipe);
}
} catch (Exception exception) {
Services.Notifier.Error(T("Post installation steps failed with error: {0}", exception.Message));