mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge from dev.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Orchard.Environment.Features;
|
||||
using Orchard.Events;
|
||||
|
||||
namespace Orchard.Modules.ImportExport {
|
||||
public interface IExportEventHandler : IEventHandler {
|
||||
void Exporting(dynamic context);
|
||||
void Exported(dynamic context);
|
||||
}
|
||||
|
||||
public class FeaturesExportHandler : IExportEventHandler {
|
||||
private readonly IFeatureManager _featureManager;
|
||||
|
||||
public FeaturesExportHandler(IFeatureManager featureManager) {
|
||||
_featureManager = featureManager;
|
||||
}
|
||||
|
||||
public void Exporting(dynamic context) {
|
||||
if (!((IEnumerable<string>)context.ExportOptions.CustomSteps).Contains("Features")) {
|
||||
return;
|
||||
}
|
||||
|
||||
var enabledFeatures = _featureManager.GetEnabledFeatures();
|
||||
|
||||
var root = new XElement("Feature", new XAttribute("enable", String.Join(", ", enabledFeatures.Select(x => x.Id).OrderBy(x => x))));
|
||||
context.Document.Element("Orchard").Add(root);
|
||||
|
||||
// Add the Migration element to force migrations run immediately after the features have been synced.
|
||||
context.Document.Element("Orchard").Add(new XElement("Migration", new XAttribute("features", "*")));
|
||||
}
|
||||
|
||||
public void Exported(dynamic context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Events;
|
||||
|
||||
namespace Orchard.Modules.ImportExport {
|
||||
public interface ICustomExportStep : IEventHandler {
|
||||
void Register(IList<string> steps);
|
||||
}
|
||||
|
||||
public class FeaturesStep : ICustomExportStep {
|
||||
public void Register(IList<string> steps) {
|
||||
steps.Add("Features");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,3 +7,13 @@ OrchardVersion: 1.9
|
||||
Description: The Modules module enables the administrator of the site to manage the installed modules as well as activate and de-activate features.
|
||||
FeatureDescription: Standard module and feature management.
|
||||
Category: Core
|
||||
Features:
|
||||
Orchard.Modules:
|
||||
Description: Standard module and feature management.
|
||||
Dependencies: Orchard.jQuery
|
||||
Category: Core
|
||||
Orchard.Modules.ExportFeatures:
|
||||
Name: Export Features
|
||||
Description: Provides feature export capability.
|
||||
Category: Deployment
|
||||
Dependencies: Orchard.ImportExport
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -64,12 +65,15 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.XML" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Data\Migration\DataMigrationNotificationProvider.cs" />
|
||||
<Compile Include="Events\IExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="ImportExport\FeaturesStep.cs" />
|
||||
<Compile Include="ImportExport\FeaturesExportHandler.cs" />
|
||||
<Compile Include="ResourceManifest.cs" />
|
||||
<Compile Include="Commands\FeatureCommands.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
|
||||
Reference in New Issue
Block a user