mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Removing some obsolete install/feature state code
Changing blog/page slug updater to use orchard shell events interface Changing default role/permission to use feature install event Renaming state manager/provider to be consistent with other components --HG-- branch : dev
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
<ALIGN_MULTIPLE_DECLARATION>False</ALIGN_MULTIPLE_DECLARATION>
|
||||
<ANONYMOUS_METHOD_DECLARATION_BRACES>END_OF_LINE</ANONYMOUS_METHOD_DECLARATION_BRACES>
|
||||
<CASE_BLOCK_BRACES>END_OF_LINE</CASE_BLOCK_BRACES>
|
||||
<EMPTY_BLOCK_STYLE>TOGETHER</EMPTY_BLOCK_STYLE>
|
||||
<FORCE_FIXED_BRACES_STYLE>ALWAYS_ADD</FORCE_FIXED_BRACES_STYLE>
|
||||
<FORCE_FOR_BRACES_STYLE>ALWAYS_ADD</FORCE_FOR_BRACES_STYLE>
|
||||
<FORCE_FOREACH_BRACES_STYLE>ALWAYS_ADD</FORCE_FOREACH_BRACES_STYLE>
|
||||
|
@@ -169,7 +169,7 @@ namespace Orchard.Specs.Bindings {
|
||||
|
||||
foreach (var row in table.Rows) {
|
||||
var r = row;
|
||||
var input = inputs.First(x => x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]);
|
||||
var input = inputs.FirstOrDefault(x => x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]);
|
||||
Assert.That(input, Is.Not.Null, "Unable to locate <input> name {0} in page html:\r\n\r\n{1}", r["name"], Details.ResponseText);
|
||||
var inputType = input.GetAttributeValue("type", "");
|
||||
switch(inputType) {
|
||||
|
@@ -52,6 +52,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
|
@@ -147,7 +147,7 @@ namespace Orchard.Tests.Modules.Settings.Topology {
|
||||
[Test]
|
||||
public void ManagerReturnsStateForFeaturesInDescriptor() {
|
||||
var descriptorManager = _container.Resolve<IShellDescriptorManager>();
|
||||
var stateManager = _container.Resolve<IShellStateProvider>();
|
||||
var stateManager = _container.Resolve<IShellStateManager>();
|
||||
var state = stateManager.GetShellState();
|
||||
Assert.That(state.Features.Count(), Is.EqualTo(0));
|
||||
descriptorManager.UpdateShellDescriptor(
|
||||
|
@@ -9,24 +9,20 @@ using Orchard.Environment.Topology.Models;
|
||||
using Orchard.Events;
|
||||
using Orchard.Tests.Utility;
|
||||
|
||||
namespace Orchard.Tests.Environment.State
|
||||
{
|
||||
namespace Orchard.Tests.Environment.State {
|
||||
[TestFixture]
|
||||
public class DefaultProcessingEngineTests
|
||||
{
|
||||
public class DefaultProcessingEngineTests {
|
||||
private IContainer _container;
|
||||
private ShellContext _shellContext;
|
||||
|
||||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
public void Init() {
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterType<DefaultProcessingEngine>().As<IProcessingEngine>();
|
||||
builder.RegisterAutoMocking();
|
||||
_container = builder.Build();
|
||||
|
||||
_shellContext = new ShellContext
|
||||
{
|
||||
_shellContext = new ShellContext {
|
||||
Descriptor = new ShellDescriptor(),
|
||||
Settings = new ShellSettings(),
|
||||
LifetimeScope = _container.BeginLifetimeScope(),
|
||||
@@ -39,16 +35,14 @@ namespace Orchard.Tests.Environment.State
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NoTasksPendingByDefault()
|
||||
{
|
||||
public void NoTasksPendingByDefault() {
|
||||
var engine = _container.Resolve<IProcessingEngine>();
|
||||
var pending = engine.AreTasksPending();
|
||||
Assert.That(pending, Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExecuteTaskIsSafeToCallWhenItDoesNothing()
|
||||
{
|
||||
public void ExecuteTaskIsSafeToCallWhenItDoesNothing() {
|
||||
var engine = _container.Resolve<IProcessingEngine>();
|
||||
var pending1 = engine.AreTasksPending();
|
||||
engine.ExecuteNextTask();
|
||||
@@ -58,11 +52,10 @@ namespace Orchard.Tests.Environment.State
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CallingAddTaskReturnsResultIdentifierAndCausesPendingToBeTrue()
|
||||
{
|
||||
public void CallingAddTaskReturnsResultIdentifierAndCausesPendingToBeTrue() {
|
||||
var engine = _container.Resolve<IProcessingEngine>();
|
||||
var pending1 = engine.AreTasksPending();
|
||||
var resultId = engine.AddTask(null, null, null, null);
|
||||
var resultId = engine.AddTask(new ShellSettings {Name = "Default"}, null, null, null);
|
||||
var pending2 = engine.AreTasksPending();
|
||||
Assert.That(pending1, Is.False);
|
||||
Assert.That(resultId, Is.Not.Null);
|
||||
@@ -71,10 +64,9 @@ namespace Orchard.Tests.Environment.State
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CallingExecuteCausesEventToFireAndPendingFlagToBeCleared()
|
||||
{
|
||||
public void CallingExecuteCausesEventToFireAndPendingFlagToBeCleared() {
|
||||
_container.Mock<IEventBus>()
|
||||
.Setup(x => x.Notify(It.IsAny<string>(), It.IsAny<Dictionary<string,object>>()));
|
||||
.Setup(x => x.Notify(It.IsAny<string>(), It.IsAny<Dictionary<string, object>>()));
|
||||
|
||||
var engine = _container.Resolve<IProcessingEngine>();
|
||||
var pending1 = engine.AreTasksPending();
|
||||
|
@@ -52,6 +52,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
|
@@ -1,3 +1,2 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BodyDisplayViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Common.ViewModels"%>
|
||||
</div>
|
@@ -133,7 +133,7 @@
|
||||
<Compile Include="Settings\Permissions.cs" />
|
||||
<Compile Include="Settings\State\Records\ShellFeatureStateRecord.cs" />
|
||||
<Compile Include="Settings\State\Records\ShellStateRecord.cs" />
|
||||
<Compile Include="Settings\State\ShellStateProvider.cs" />
|
||||
<Compile Include="Settings\State\ShellStateManager.cs" />
|
||||
<Compile Include="Settings\Topology\Records\ShellFeatureRecord.cs" />
|
||||
<Compile Include="Settings\Topology\Records\ShellParameterRecord.cs" />
|
||||
<Compile Include="Settings\Topology\Records\ShellDescriptorRecord.cs" />
|
||||
|
@@ -7,11 +7,11 @@ using Orchard.Environment.Topology;
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.Core.Settings.State {
|
||||
public class ShellStateProvider : Component, IShellStateProvider {
|
||||
public class ShellStateManager : Component, IShellStateManager {
|
||||
private readonly IRepository<ShellStateRecord> _shellStateRepository;
|
||||
private readonly IShellDescriptorManager _shellDescriptorManager;
|
||||
|
||||
public ShellStateProvider(
|
||||
public ShellStateManager(
|
||||
IRepository<ShellStateRecord> shellStateRepository,
|
||||
IShellDescriptorManager shellDescriptorManager) {
|
||||
_shellStateRepository = shellStateRepository;
|
@@ -1,12 +1,12 @@
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Tasks;
|
||||
|
||||
namespace Orchard.Blogs.Routing {
|
||||
[UsedImplicitly]
|
||||
public class BlogSlugConstraintUpdator : ExtensionManagerEvents, IBackgroundTask {
|
||||
public class BlogSlugConstraintUpdator : IOrchardShellEvents, IBackgroundTask {
|
||||
private readonly IBlogSlugConstraint _blogSlugConstraint;
|
||||
private readonly IBlogService _blogService;
|
||||
|
||||
@@ -15,13 +15,14 @@ namespace Orchard.Blogs.Routing {
|
||||
_blogService = blogService;
|
||||
}
|
||||
|
||||
public override void Activated(ExtensionEventContext context) {
|
||||
if (context.Extension.Descriptor.Name == "Orchard.Blogs") {
|
||||
Refresh();
|
||||
}
|
||||
void IOrchardShellEvents.Activated() {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public void Sweep() {
|
||||
void IOrchardShellEvents.Terminating() {
|
||||
}
|
||||
|
||||
void IBackgroundTask.Sweep() {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
@@ -1,12 +1,12 @@
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Pages.Services;
|
||||
using Orchard.Tasks;
|
||||
|
||||
namespace Orchard.Pages.Routing {
|
||||
[UsedImplicitly]
|
||||
public class PageSlugConstraintUpdator : ExtensionManagerEvents, IBackgroundTask {
|
||||
public class PageSlugConstraintUpdator : IOrchardShellEvents, IBackgroundTask {
|
||||
private readonly IPageSlugConstraint _pageSlugConstraint;
|
||||
private readonly IPageService _pageService;
|
||||
|
||||
@@ -15,18 +15,20 @@ namespace Orchard.Pages.Routing {
|
||||
_pageService = pageService;
|
||||
}
|
||||
|
||||
public override void Activated(ExtensionEventContext context) {
|
||||
if (context.Extension.Descriptor.Name == "Orchard.Pages") {
|
||||
Refresh();
|
||||
}
|
||||
void IOrchardShellEvents.Activated() {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public void Sweep() {
|
||||
void IOrchardShellEvents.Terminating() {
|
||||
}
|
||||
|
||||
void IBackgroundTask.Sweep() {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void Refresh() {
|
||||
_pageSlugConstraint.SetSlugs(_pageService.Get(PageStatus.Published).Select(p => p.Slug));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,18 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Roles.Services;
|
||||
using Orchard.Security.Permissions;
|
||||
|
||||
namespace Orchard.Roles {
|
||||
[UsedImplicitly]
|
||||
public class Extension : ExtensionManagerEvents {
|
||||
public class DefaultRoleUpdater : IFeatureEventHandler {
|
||||
private readonly IRoleService _roleService;
|
||||
private readonly IEnumerable<IPermissionProvider> _permissionProviders;
|
||||
|
||||
public Extension(
|
||||
public DefaultRoleUpdater(
|
||||
IRoleService roleService,
|
||||
IEnumerable<IPermissionProvider> permissionProviders) {
|
||||
_roleService = roleService;
|
||||
@@ -23,18 +24,27 @@ namespace Orchard.Roles {
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public override void Enabled(ExtensionEventContext context) {
|
||||
var extensionDisplayName = context.Extension.Descriptor.DisplayName ?? context.Extension.Descriptor.Name;
|
||||
void IFeatureEventHandler.Install(Feature feature) {
|
||||
AddDefaultRolesForFeature(feature);
|
||||
}
|
||||
|
||||
void IFeatureEventHandler.Enable(Feature feature) {}
|
||||
|
||||
void IFeatureEventHandler.Disable(Feature feature) {}
|
||||
|
||||
void IFeatureEventHandler.Uninstall(Feature feature) {}
|
||||
|
||||
public void AddDefaultRolesForFeature(Feature feature) {
|
||||
var featureName = feature.Descriptor.Name;
|
||||
|
||||
// when another module is being enabled, locate matching permission providers
|
||||
var providersForEnabledModule =
|
||||
_permissionProviders.Where(x => x.ModuleName == extensionDisplayName);
|
||||
var providersForEnabledModule = _permissionProviders.Where(x => x.ModuleName == featureName);
|
||||
|
||||
if (providersForEnabledModule.Any()) {
|
||||
Logger.Debug("Configuring default roles for module {0}", extensionDisplayName);
|
||||
Logger.Debug("Configuring default roles for module {0}", featureName);
|
||||
}
|
||||
else {
|
||||
Logger.Debug("No default roles for module {0}", extensionDisplayName);
|
||||
Logger.Debug("No default roles for module {0}", featureName);
|
||||
}
|
||||
|
||||
foreach (var permissionProvider in providersForEnabledModule) {
|
@@ -68,7 +68,7 @@
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Drivers\UserRolesDriver.cs" />
|
||||
<Compile Include="Extension.cs" />
|
||||
<Compile Include="DefaultRoleUpdater.cs" />
|
||||
<Compile Include="Models\IUserRoles.cs" />
|
||||
<Compile Include="Models\UserSimulation.cs" />
|
||||
<Compile Include="Permissions.cs" />
|
||||
|
@@ -80,7 +80,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Module.txt" />
|
||||
<Content Include="Views\DisplayTemplates\Fields\Sandbox.BingMap.ascx" />
|
||||
<Content Include="Views\Page\Edit.aspx" />
|
||||
<Content Include="Views\Page\Create.aspx" />
|
||||
<Content Include="Views\Page\Show.aspx" />
|
||||
|
@@ -132,9 +132,10 @@ namespace Orchard.Setup.Services {
|
||||
|
||||
var contentManager = environment.Resolve<IContentManager>();
|
||||
|
||||
// this needs to exit the standalone environment? rework this process entirely?
|
||||
// simulate installation-time module activation events
|
||||
var hackInstallationGenerator = environment.Resolve<IHackInstallationGenerator>();
|
||||
hackInstallationGenerator.GenerateInstallEvents();
|
||||
//var hackInstallationGenerator = environment.Resolve<IHackInstallationGenerator>();
|
||||
//hackInstallationGenerator.GenerateInstallEvents();
|
||||
|
||||
// create home page as a CMS page
|
||||
var page = contentManager.Create("page", VersionOptions.Draft);
|
||||
|
@@ -45,7 +45,6 @@ namespace Orchard.Setup {
|
||||
builder.RegisterType<HelpCommand>().As<ICommandHandler>().InstancePerLifetimeScope();
|
||||
|
||||
// setup mode specific implementations of needed service interfaces
|
||||
builder.RegisterType<NullHackInstallationGenerator>().As<IHackInstallationGenerator>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<SafeModeThemeService>().As<IThemeService>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<SafeModeText>().As<IText>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<SafeModeSiteService>().As<ISiteService>().InstancePerLifetimeScope();
|
||||
@@ -88,10 +87,6 @@ namespace Orchard.Setup {
|
||||
public void UninstallTheme(string themeName) { }
|
||||
}
|
||||
|
||||
class NullHackInstallationGenerator : IHackInstallationGenerator {
|
||||
public void GenerateInstallEvents() { }
|
||||
public void GenerateActivateEvents() { }
|
||||
}
|
||||
|
||||
class SafeModeSiteService : ISiteService {
|
||||
public ISite GetSiteSettings() {
|
||||
|
@@ -1,54 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Environment.Extensions {
|
||||
public interface IHackInstallationGenerator : IDependency {
|
||||
void GenerateInstallEvents();
|
||||
void GenerateActivateEvents();
|
||||
}
|
||||
|
||||
public class HackInstallationGenerator : IHackInstallationGenerator {
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
private readonly IEnumerable<IExtensionManagerEvents> _extensionEvents;
|
||||
|
||||
public HackInstallationGenerator(
|
||||
IExtensionManager extensionManager,
|
||||
IEnumerable<IExtensionManagerEvents> extensionEvents) {
|
||||
_extensionManager = extensionManager;
|
||||
_extensionEvents = extensionEvents;
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public void GenerateInstallEvents() {
|
||||
//TEMP: this is really part of the extension manager's job. an extension
|
||||
// install event is being simulated here on each web app startup
|
||||
var enabled = new List<ExtensionEntry>();
|
||||
foreach (var extension in _extensionManager.ActiveExtensions_Obsolete()) {
|
||||
var context = new ExtensionEventContext {
|
||||
Extension = extension,
|
||||
EnabledExtensions = enabled.ToReadOnlyCollection(),
|
||||
};
|
||||
_extensionEvents.Invoke(x => x.Enabling(context), Logger);
|
||||
enabled.Add(extension);
|
||||
context.EnabledExtensions = enabled.ToReadOnlyCollection();
|
||||
_extensionEvents.Invoke(x => x.Enabled(context), Logger);
|
||||
}
|
||||
}
|
||||
|
||||
public void GenerateActivateEvents() {
|
||||
//TEMP: This is really part of the extension manager's job.
|
||||
var extensions = _extensionManager.ActiveExtensions_Obsolete().ToReadOnlyCollection();
|
||||
foreach (var extension in extensions) {
|
||||
var context = new ExtensionEventContext {
|
||||
Extension = extension,
|
||||
EnabledExtensions = extensions,
|
||||
};
|
||||
_extensionEvents.Invoke(x => x.Activating(context), Logger);
|
||||
_extensionEvents.Invoke(x => x.Activated(context), Logger);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,30 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Orchard.Environment.Extensions {
|
||||
public interface IExtensionManagerEvents : IEvents {
|
||||
void Enabling(ExtensionEventContext context);
|
||||
void Enabled(ExtensionEventContext context);
|
||||
void Disabling(ExtensionEventContext context);
|
||||
void Disabled(ExtensionEventContext context);
|
||||
void Activating(ExtensionEventContext context);
|
||||
void Activated(ExtensionEventContext context);
|
||||
void Deactivating(ExtensionEventContext context);
|
||||
void Deactivated(ExtensionEventContext context);
|
||||
}
|
||||
|
||||
public abstract class ExtensionManagerEvents : IExtensionManagerEvents {
|
||||
public virtual void Enabling(ExtensionEventContext context) { }
|
||||
public virtual void Enabled(ExtensionEventContext context) { }
|
||||
public virtual void Disabling(ExtensionEventContext context) {}
|
||||
public virtual void Disabled(ExtensionEventContext context) {}
|
||||
public virtual void Activating(ExtensionEventContext context) {}
|
||||
public virtual void Activated(ExtensionEventContext context) {}
|
||||
public virtual void Deactivating(ExtensionEventContext context) {}
|
||||
public virtual void Deactivated(ExtensionEventContext context) {}
|
||||
}
|
||||
|
||||
public class ExtensionEventContext {
|
||||
public ExtensionEntry Extension { get; set; }
|
||||
public IEnumerable<ExtensionEntry> EnabledExtensions { get; set; }
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using Orchard.Environment.State.Models;
|
||||
|
||||
namespace Orchard.Environment.State {
|
||||
public interface IShellStateProvider : IDependency {
|
||||
public interface IShellStateManager : IDependency {
|
||||
ShellState GetShellState();
|
||||
void UpdateEnabledState(ShellFeatureState featureState, ShellFeatureState.State value);
|
||||
void UpdateInstalledState(ShellFeatureState featureState, ShellFeatureState.State value);
|
@@ -17,7 +17,6 @@ namespace Orchard.Environment.State.Models {
|
||||
public bool IsInstalled { get { return InstallState == State.Up; } }
|
||||
public bool IsEnabled { get { return EnableState == State.Up; } }
|
||||
public bool IsDisabled { get { return EnableState == State.Down || EnableState == State.Undefined; } }
|
||||
public bool IsUninstalled { get { return InstallState == State.Down || InstallState == State.Undefined; } }
|
||||
|
||||
public enum State {
|
||||
Undefined,
|
||||
|
@@ -9,21 +9,21 @@ using Orchard.Environment.Topology;
|
||||
using Orchard.Environment.Topology.Models;
|
||||
|
||||
namespace Orchard.Environment.State {
|
||||
public class ShellStateManager : IShellStateManagerEventHandler, IShellDescriptorManagerEventHandler {
|
||||
public class ShellStateCoordinator : IShellStateManagerEventHandler, IShellDescriptorManagerEventHandler {
|
||||
private readonly ShellSettings _settings;
|
||||
private readonly IShellStateProvider _stateProvider;
|
||||
private readonly IShellStateManager _stateManager;
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
private readonly IProcessingEngine _processingEngine;
|
||||
private readonly IFeatureEventHandler _featureEvents;
|
||||
|
||||
public ShellStateManager(
|
||||
public ShellStateCoordinator(
|
||||
ShellSettings settings,
|
||||
IShellStateProvider stateProvider,
|
||||
IShellStateManager stateManager,
|
||||
IExtensionManager extensionManager,
|
||||
IProcessingEngine processingEngine,
|
||||
IFeatureEventHandler featureEvents) {
|
||||
_settings = settings;
|
||||
_stateProvider = stateProvider;
|
||||
_stateManager = stateManager;
|
||||
_extensionManager = extensionManager;
|
||||
_processingEngine = processingEngine;
|
||||
_featureEvents = featureEvents;
|
||||
@@ -31,7 +31,7 @@ namespace Orchard.Environment.State {
|
||||
|
||||
void IShellDescriptorManagerEventHandler.Changed(ShellDescriptor descriptor) {
|
||||
// deduce and apply state changes involved
|
||||
var shellState = _stateProvider.GetShellState();
|
||||
var shellState = _stateManager.GetShellState();
|
||||
foreach (var feature in descriptor.Features) {
|
||||
var featureName = feature.Name;
|
||||
var featureState = shellState.Features.SingleOrDefault(f => f.Name == featureName);
|
||||
@@ -42,10 +42,10 @@ namespace Orchard.Environment.State {
|
||||
shellState.Features = shellState.Features.Concat(new[] { featureState });
|
||||
}
|
||||
if (!featureState.IsInstalled) {
|
||||
_stateProvider.UpdateInstalledState(featureState, ShellFeatureState.State.Rising);
|
||||
_stateManager.UpdateInstalledState(featureState, ShellFeatureState.State.Rising);
|
||||
}
|
||||
if (!featureState.IsEnabled) {
|
||||
_stateProvider.UpdateEnabledState(featureState, ShellFeatureState.State.Rising);
|
||||
_stateManager.UpdateEnabledState(featureState, ShellFeatureState.State.Rising);
|
||||
}
|
||||
}
|
||||
foreach (var featureState in shellState.Features) {
|
||||
@@ -54,7 +54,7 @@ namespace Orchard.Environment.State {
|
||||
continue;
|
||||
}
|
||||
if (!featureState.IsDisabled) {
|
||||
_stateProvider.UpdateEnabledState(featureState, ShellFeatureState.State.Falling);
|
||||
_stateManager.UpdateEnabledState(featureState, ShellFeatureState.State.Falling);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Orchard.Environment.State {
|
||||
}
|
||||
|
||||
private void FireApplyChangesIfNeeded() {
|
||||
var shellState = _stateProvider.GetShellState();
|
||||
var shellState = _stateManager.GetShellState();
|
||||
if (shellState.Features.Any(FeatureIsChanging)) {
|
||||
var descriptor = new ShellDescriptor {
|
||||
Features = shellState.Features
|
||||
@@ -98,7 +98,7 @@ namespace Orchard.Environment.State {
|
||||
}
|
||||
|
||||
void IShellStateManagerEventHandler.ApplyChanges() {
|
||||
var shellState = _stateProvider.GetShellState();
|
||||
var shellState = _stateManager.GetShellState();
|
||||
|
||||
// start with description of all declared features in order - order preserved with all merging
|
||||
var orderedFeatureDescriptors = AllFeaturesInOrder();
|
||||
@@ -150,24 +150,24 @@ namespace Orchard.Environment.State {
|
||||
// lower enabled states in reverse order
|
||||
foreach (var entry in allEntries.Where(entry => entry.FeatureState.EnableState == ShellFeatureState.State.Falling)) {
|
||||
_featureEvents.Disable(entry.Feature);
|
||||
_stateProvider.UpdateEnabledState(entry.FeatureState, ShellFeatureState.State.Down);
|
||||
_stateManager.UpdateEnabledState(entry.FeatureState, ShellFeatureState.State.Down);
|
||||
}
|
||||
|
||||
// lower installed states in reverse order
|
||||
foreach (var entry in allEntries.Where(entry => entry.FeatureState.InstallState == ShellFeatureState.State.Falling)) {
|
||||
_featureEvents.Uninstall(entry.Feature);
|
||||
_stateProvider.UpdateInstalledState(entry.FeatureState, ShellFeatureState.State.Down);
|
||||
_stateManager.UpdateInstalledState(entry.FeatureState, ShellFeatureState.State.Down);
|
||||
}
|
||||
|
||||
// raise install and enabled states in order
|
||||
foreach (var entry in allEntries.Where(entry => IsRising(entry.FeatureState))) {
|
||||
if (entry.FeatureState.InstallState == ShellFeatureState.State.Rising) {
|
||||
_featureEvents.Install(entry.Feature);
|
||||
_stateProvider.UpdateInstalledState(entry.FeatureState, ShellFeatureState.State.Up);
|
||||
_stateManager.UpdateInstalledState(entry.FeatureState, ShellFeatureState.State.Up);
|
||||
}
|
||||
if (entry.FeatureState.EnableState == ShellFeatureState.State.Rising) {
|
||||
_featureEvents.Enable(entry.Feature);
|
||||
_stateProvider.UpdateEnabledState(entry.FeatureState, ShellFeatureState.State.Up);
|
||||
_stateManager.UpdateEnabledState(entry.FeatureState, ShellFeatureState.State.Up);
|
||||
}
|
||||
}
|
||||
|
@@ -140,8 +140,8 @@
|
||||
<Compile Include="Environment\State\DefaultProcessingEngine.cs" />
|
||||
<Compile Include="Environment\State\IProcessingEngine.cs" />
|
||||
<Compile Include="Environment\State\IShellStateManagerEventHandler.cs" />
|
||||
<Compile Include="Environment\State\IShellStateProvider.cs" />
|
||||
<Compile Include="Environment\State\ShellStateManager.cs" />
|
||||
<Compile Include="Environment\State\IShellStateManager.cs" />
|
||||
<Compile Include="Environment\State\ShellStateCoordinator.cs" />
|
||||
<Compile Include="IDependency.cs" />
|
||||
<Compile Include="Mvc\Html\ThemeExtensions.cs" />
|
||||
<Compile Include="Mvc\Routes\IRoutePublisher.cs" />
|
||||
@@ -325,8 +325,6 @@
|
||||
<Compile Include="ContentManagement\Records\ContentPartVersionRecord.cs" />
|
||||
<Compile Include="ContentManagement\Records\ContentTypeRecord.cs" />
|
||||
<Compile Include="ContentManagement\Records\Utility.cs" />
|
||||
<Compile Include="Environment\Extensions\HackInstallationGenerator.cs" />
|
||||
<Compile Include="Environment\Extensions\IExtensionManagerEvents.cs" />
|
||||
<Compile Include="Localization\Text.cs" />
|
||||
<Compile Include="Mvc\ViewModels\ContentItemViewModel.cs" />
|
||||
<Compile Include="ContentManagement\ViewModels\TemplateViewModel.cs" />
|
||||
@@ -501,7 +499,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="ContentManagement\MetaData\Models\" />
|
||||
<Folder Include="Environment\ProcessEngine\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
Reference in New Issue
Block a user