mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-25 10:58:31 +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 IRecipeHarvester _recipeHarvester;
|
||||||
private readonly IRecipeManager _recipeManager;
|
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(
|
public PackagingServicesController(
|
||||||
ShellSettings shellSettings,
|
ShellSettings shellSettings,
|
||||||
IPackageManager packageManager,
|
IPackageManager packageManager,
|
||||||
@ -163,11 +174,14 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
FeatureDescriptor = featureDescriptor
|
FeatureDescriptor = featureDescriptor
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
List<PackagingInstallRecipeViewModel> recipes = _recipeHarvester.HarvestRecipes(extensionDescriptor.Id)
|
List<PackagingInstallRecipeViewModel> recipes = null;
|
||||||
|
if (_recipeHarvester != null) {
|
||||||
|
recipes = _recipeHarvester.HarvestRecipes(extensionDescriptor.Id)
|
||||||
.Select(recipe => new PackagingInstallRecipeViewModel {
|
.Select(recipe => new PackagingInstallRecipeViewModel {
|
||||||
Execute = false, // by default no recipes are executed
|
Execute = false, // by default no recipes are executed
|
||||||
Recipe = recipe
|
Recipe = recipe
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
if (features.Count > 0) {
|
if (features.Count > 0) {
|
||||||
return View("InstallModuleDetails", new PackagingInstallViewModel {
|
return View("InstallModuleDetails", new PackagingInstallViewModel {
|
||||||
@ -187,6 +201,7 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (_recipeHarvester != null && _recipeManager != null) {
|
||||||
IEnumerable<Recipe> recipes = _recipeHarvester.HarvestRecipes(packagingInstallViewModel.ExtensionDescriptor.Id)
|
IEnumerable<Recipe> recipes = _recipeHarvester.HarvestRecipes(packagingInstallViewModel.ExtensionDescriptor.Id)
|
||||||
.Where(loadedRecipe => packagingInstallViewModel.Recipes.FirstOrDefault(recipeViewModel => recipeViewModel.Execute && recipeViewModel.Recipe.Name.Equals(loadedRecipe.Name)) != null);
|
.Where(loadedRecipe => packagingInstallViewModel.Recipes.FirstOrDefault(recipeViewModel => recipeViewModel.Execute && recipeViewModel.Recipe.Name.Equals(loadedRecipe.Name)) != null);
|
||||||
|
|
||||||
@ -198,6 +213,7 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
Services.Notifier.Error(T("Recipes contains {0} unsuported module installation steps.", recipe.Name));
|
Services.Notifier.Error(T("Recipes contains {0} unsuported module installation steps.", recipe.Name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Enable selected features
|
// Enable selected features
|
||||||
if (packagingInstallViewModel.Features.Count > 0) {
|
if (packagingInstallViewModel.Features.Count > 0) {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
@Html.HiddenFor(m => m.ExtensionDescriptor.Id)
|
@Html.HiddenFor(m => m.ExtensionDescriptor.Id)
|
||||||
|
|
||||||
if (Model.Recipes.Count > 0) {
|
if (Model.Recipes != null && Model.Recipes.Count > 0) {
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>@T("Pick the recipes you want to run").ToString()</legend>
|
<legend>@T("Pick the recipes you want to run").ToString()</legend>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user