Split feature lifetime events to "xx'ing" and "xx'ed"

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-12-04 15:31:24 -08:00
parent b12a25e169
commit f794b3f955
6 changed files with 93 additions and 32 deletions

View File

@@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Orchard.Environment;
using Orchard.Environment.Extensions.Models;
using Orchard.Tasks.Indexing;
using Orchard.ContentManagement;
namespace Orchard.Indexing {
public class DefaultIndexingUpdater : IFeatureEventHandler {
private readonly IIndexingTaskManager _indexingTaskManager;
private readonly IContentManager _contentManager;
@@ -17,10 +14,16 @@ namespace Orchard.Indexing {
_contentManager = contentManager;
}
public void Install(Environment.Extensions.Models.Feature feature) {
public void Installing(Feature feature) {
}
public void Enable(Environment.Extensions.Models.Feature feature) {
public void Installed(Feature feature) {
}
public void Enabling(Feature feature) {
}
public void Enabled(Feature feature) {
// create indexing tasks for all currently existing content, even when the module is enabled again
// as some content might have been created while this module was not active, and indexing tasks
// would not exist for them, resulting in an uncomplete index.
@@ -30,10 +33,16 @@ namespace Orchard.Indexing {
}
}
public void Disable(Environment.Extensions.Models.Feature feature) {
public void Disabling(Feature feature) {
}
public void Uninstall(Environment.Extensions.Models.Feature feature) {
public void Disabled(Feature feature) {
}
public void Uninstalling(Feature feature) {
}
public void Uninstalled(Feature feature) {
}
}
}

View File

@@ -1,4 +1,5 @@
using Orchard.Environment;
using System;
using Orchard.Environment;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.Localization;
@@ -15,17 +16,31 @@ namespace Orchard.Packaging {
public Localizer T { get; set; }
public void Install(Feature feature) {
_packagingSourceManager.AddSource( "Orchard Extensions Gallery", "http://feed.nuget.org/ctp2/odata/v1" );
public void Installing(Feature feature) {
}
public void Enable(Feature feature) {
public void Installed(Feature feature) {
if (feature.Descriptor.Id == "Gallery") {
_packagingSourceManager.AddSource("Orchard Extensions Gallery", "http://feed.nuget.org/ctp2/odata/v1");
}
}
public void Disable(Feature feature) {
public void Enabling(Feature feature) {
}
public void Uninstall(Feature feature) {
public void Enabled(Feature feature) {
}
public void Disabling(Feature feature) {
}
public void Disabled(Feature feature) {
}
public void Uninstalling(Feature feature) {
}
public void Uninstalled(Feature feature) {
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Orchard.Environment;
@@ -24,15 +25,30 @@ namespace Orchard.Roles {
public ILogger Logger { get; set; }
void IFeatureEventHandler.Install(Feature feature) {
void IFeatureEventHandler.Installing(Feature feature) {
AddDefaultRolesForFeature(feature);
}
void IFeatureEventHandler.Enable(Feature feature) {}
void IFeatureEventHandler.Installed(Feature feature) {
}
void IFeatureEventHandler.Disable(Feature feature) {}
void IFeatureEventHandler.Enabling(Feature feature) {
}
void IFeatureEventHandler.Uninstall(Feature feature) {}
void IFeatureEventHandler.Enabled(Feature feature) {
}
void IFeatureEventHandler.Disabling(Feature feature) {
}
void IFeatureEventHandler.Disabled(Feature feature) {
}
void IFeatureEventHandler.Uninstalling(Feature feature) {
}
void IFeatureEventHandler.Uninstalled(Feature feature) {
}
public void AddDefaultRolesForFeature(Feature feature) {
var featureName = feature.Descriptor.Id;