mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-24 05:41:44 +08:00
#17742: Making package installation work even if recipes module / feature is not enabled.
--HG-- branch : 1.x
This commit is contained in:
parent
674fe6ecb8
commit
fe41a08e8e
@ -37,6 +37,17 @@ namespace Orchard.Packaging.Controllers {
|
||||
private readonly IRecipeHarvester _recipeHarvester;
|
||||
private readonly IRecipeManager _recipeManager;
|
||||
|
||||
public PackagingServicesController(
|
||||
ShellSettings shellSettings,
|
||||
IPackageManager packageManager,
|
||||
IPackagingSourceManager packagingSourceManager,
|
||||
INotifier notifier,
|
||||
IAppDataFolderRoot appDataFolderRoot,
|
||||
IOrchardServices services,
|
||||
IModuleService moduleService)
|
||||
: this(shellSettings, packageManager, packagingSourceManager, notifier, appDataFolderRoot, services, moduleService, null, null) {
|
||||
}
|
||||
|
||||
public PackagingServicesController(
|
||||
ShellSettings shellSettings,
|
||||
IPackageManager packageManager,
|
||||
@ -163,11 +174,14 @@ namespace Orchard.Packaging.Controllers {
|
||||
FeatureDescriptor = featureDescriptor
|
||||
}).ToList();
|
||||
|
||||
List<PackagingInstallRecipeViewModel> recipes = _recipeHarvester.HarvestRecipes(extensionDescriptor.Id)
|
||||
.Select(recipe => new PackagingInstallRecipeViewModel {
|
||||
Execute = false, // by default no recipes are executed
|
||||
Recipe = recipe
|
||||
}).ToList();
|
||||
List<PackagingInstallRecipeViewModel> recipes = null;
|
||||
if (_recipeHarvester != null) {
|
||||
recipes = _recipeHarvester.HarvestRecipes(extensionDescriptor.Id)
|
||||
.Select(recipe => new PackagingInstallRecipeViewModel {
|
||||
Execute = false, // by default no recipes are executed
|
||||
Recipe = recipe
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
if (features.Count > 0) {
|
||||
return View("InstallModuleDetails", new PackagingInstallViewModel {
|
||||
@ -187,15 +201,17 @@ namespace Orchard.Packaging.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
try {
|
||||
IEnumerable<Recipe> recipes = _recipeHarvester.HarvestRecipes(packagingInstallViewModel.ExtensionDescriptor.Id)
|
||||
.Where(loadedRecipe => packagingInstallViewModel.Recipes.FirstOrDefault(recipeViewModel => recipeViewModel.Execute && recipeViewModel.Recipe.Name.Equals(loadedRecipe.Name)) != null);
|
||||
if (_recipeHarvester != null && _recipeManager != null) {
|
||||
IEnumerable<Recipe> recipes = _recipeHarvester.HarvestRecipes(packagingInstallViewModel.ExtensionDescriptor.Id)
|
||||
.Where(loadedRecipe => packagingInstallViewModel.Recipes.FirstOrDefault(recipeViewModel => recipeViewModel.Execute && recipeViewModel.Recipe.Name.Equals(loadedRecipe.Name)) != null);
|
||||
|
||||
foreach (Recipe recipe in recipes) {
|
||||
try {
|
||||
_recipeManager.Execute(recipe);
|
||||
}
|
||||
catch {
|
||||
Services.Notifier.Error(T("Recipes contains {0} unsuported module installation steps.", recipe.Name));
|
||||
foreach (Recipe recipe in recipes) {
|
||||
try {
|
||||
_recipeManager.Execute(recipe);
|
||||
}
|
||||
catch {
|
||||
Services.Notifier.Error(T("Recipes contains {0} unsuported module installation steps.", recipe.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
@Html.HiddenFor(m => m.ExtensionDescriptor.Id)
|
||||
|
||||
if (Model.Recipes.Count > 0) {
|
||||
if (Model.Recipes != null && Model.Recipes.Count > 0) {
|
||||
<fieldset>
|
||||
<legend>@T("Pick the recipes you want to run").ToString()</legend>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user