mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-19 17:51:45 +08:00
Fixed broken setup due to auto-enabling features.
This change will only auto-enable features for already running shells.
This commit is contained in:
@@ -10,7 +10,7 @@ Features:
|
|||||||
Orchard.Layouts:
|
Orchard.Layouts:
|
||||||
Name: Layouts
|
Name: Layouts
|
||||||
Description: Provides tools to create layouts.
|
Description: Provides tools to create layouts.
|
||||||
Dependencies: Common, Orchard.jQuery, Orchard.Forms, Orchard.Tokens, Orchard.MediaLibrary, TinyMCE, Orchard.Widgets
|
Dependencies: Common, Orchard.jQuery, Orchard.Forms, Orchard.Tokens, Orchard.MediaLibrary, TinyMce, Orchard.Widgets
|
||||||
Category: Layout
|
Category: Layout
|
||||||
Orchard.Layouts.Snippets:
|
Orchard.Layouts.Snippets:
|
||||||
Name: Layout Snippets
|
Name: Layout Snippets
|
||||||
|
|||||||
@@ -33,9 +33,14 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
var builtinFeatureDescriptors = builtinFeatures.Select(x => x.Descriptor).ToList();
|
var builtinFeatureDescriptors = builtinFeatures.Select(x => x.Descriptor).ToList();
|
||||||
var availableFeatures = _extensionManager.AvailableFeatures().Concat(builtinFeatureDescriptors).ToDictionary(x => x.Id);
|
var availableFeatures = _extensionManager.AvailableFeatures().Concat(builtinFeatureDescriptors).ToDictionary(x => x.Id);
|
||||||
var enabledFeatures = _extensionManager.EnabledFeatures(descriptor).Select(x => x.Id).ToList();
|
var enabledFeatures = _extensionManager.EnabledFeatures(descriptor).Select(x => x.Id).ToList();
|
||||||
var expandedFeatures = ExpandDependencies(availableFeatures, descriptor.Features.Select(x => x.Name)).ToList();
|
var featuresToLoad = descriptor.Features.Select(x => x.Name).ToList();
|
||||||
var autoEnabledDependencyFeatures = expandedFeatures.Except(enabledFeatures).Except(builtinFeatureDescriptors.Select(x => x.Id)).ToList();
|
|
||||||
var featureDescriptors = _extensionManager.EnabledFeatures(expandedFeatures.Select(x => new ShellFeature { Name = x})).ToList();
|
// Only auto-enable features for already running shells.
|
||||||
|
if(settings.State == TenantState.Running) {
|
||||||
|
featuresToLoad = ExpandDependencies(availableFeatures, enabledFeatures).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
var featureDescriptors = _extensionManager.EnabledFeatures(featuresToLoad.Select(x => new ShellFeature { Name = x})).ToList();
|
||||||
var features = _extensionManager.LoadFeatures(featureDescriptors);
|
var features = _extensionManager.LoadFeatures(featureDescriptors);
|
||||||
|
|
||||||
if (descriptor.Features.Any(feature => feature.Name == "Orchard.Framework"))
|
if (descriptor.Features.Any(feature => feature.Name == "Orchard.Framework"))
|
||||||
@@ -59,8 +64,9 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
|
|
||||||
Logger.Debug("Done composing blueprint.");
|
Logger.Debug("Done composing blueprint.");
|
||||||
|
|
||||||
|
// Add any dependencies previously not enabled to the shell descriptor.
|
||||||
|
var autoEnabledDependencyFeatures = featuresToLoad.Except(enabledFeatures).Except(builtinFeatureDescriptors.Select(x => x.Id)).ToList();
|
||||||
if (autoEnabledDependencyFeatures.Any()) {
|
if (autoEnabledDependencyFeatures.Any()) {
|
||||||
// Add any dependencies previously not enabled to the shell descriptor.
|
|
||||||
descriptor.Features = descriptor.Features.Concat(autoEnabledDependencyFeatures.Select(x => new ShellFeature { Name = x })).ToList();
|
descriptor.Features = descriptor.Features.Concat(autoEnabledDependencyFeatures.Select(x => new ShellFeature { Name = x })).ToList();
|
||||||
Logger.Information("Automatically enabled the following dependency features: {0}.", String.Join(", ", autoEnabledDependencyFeatures));
|
Logger.Information("Automatically enabled the following dependency features: {0}.", String.Join(", ", autoEnabledDependencyFeatures));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user