mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
Merge dev -> perf
--HG-- branch : perf
This commit is contained in:
24
Orchard.proj
24
Orchard.proj
@@ -42,6 +42,22 @@
|
||||
<CallTarget Targets="Package"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="FullBuild">
|
||||
<CallTarget Targets="Clean"/>
|
||||
<CallTarget Targets="Compile"/>
|
||||
<CallTarget Targets="Test"/>
|
||||
<CallTarget Targets="Package"/>
|
||||
<CallTarget Targets="Gallery"/>
|
||||
<CallTarget Targets="Spec"/> <!-- Note: move to the end until SpecFlow test are more reliable -->
|
||||
</Target>
|
||||
|
||||
<Target Name="FastPackage">
|
||||
<CallTarget Targets="Clean"/>
|
||||
<CallTarget Targets="Compile"/>
|
||||
<CallTarget Targets="Package"/>
|
||||
<CallTarget Targets="Gallery"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="Package">
|
||||
<CallTarget Targets="Package-Stage"/>
|
||||
<CallTarget Targets="Package-MsDeploy"/>
|
||||
@@ -56,11 +72,7 @@
|
||||
<CallTarget Targets="Profiling-Setup"/>
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name="Gallery">
|
||||
<CallTarget Targets="Clean"/>
|
||||
<CallTarget Targets="Compile"/>
|
||||
<CallTarget Targets="Package-Stage"/>
|
||||
<CallTarget Targets="Gallery-Stage"/>
|
||||
<CallTarget Targets="Gallery-Setup"/>
|
||||
</Target>
|
||||
@@ -319,7 +331,7 @@
|
||||
|
||||
<Target Name="Gallery-Setup">
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" setup /SiteName:Gallery /AdminUsername:admin /AdminPassword:gallery-secret /DatabaseProvider:SqlCe" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" feature enable Orchard.Packaging "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" feature enable Orchard.Packaging" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Localization "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Messaging "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Lucene "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
@@ -330,7 +342,7 @@
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Indexing "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Migrations "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.MultiTenancy "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Scriping.Dlr "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Scripting.Dlr "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Search "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
</Target>
|
||||
|
||||
|
@@ -44,8 +44,6 @@
|
||||
</system.transactions>
|
||||
|
||||
<system.web>
|
||||
<machineKey validationKey="013B82F217ABB7EAB1F699E4E5B4D290030644D435994692354DAE82B06568B058BFE3C57BF199A41FFDBC84F3BC74D9C5BD96D1265F36A22D58347B591AC8DD" decryptionKey="04797035C490263D73ED991C84C5DFCD0D0206AD4F12BC3638A38FBEABEBB8C7" validation="SHA1" decryption="AES" />
|
||||
|
||||
<httpRuntime requestValidationMode="2.0" />
|
||||
<!--
|
||||
Set compilation debug="true" to insert debugging
|
||||
@@ -53,7 +51,7 @@
|
||||
affects performance, set this value to true only
|
||||
during development.
|
||||
-->
|
||||
<compilation targetFramework="4.0">
|
||||
<compilation targetFramework="4.0" numRecompilesBeforeAppRestart="1000">
|
||||
<buildProviders>
|
||||
<add extension=".csproj" type="Orchard.Environment.Extensions.Compilers.CSharpExtensionBuildProviderShim"/>
|
||||
</buildProviders>
|
||||
|
@@ -1,5 +1,9 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Hosting;
|
||||
using Orchard.Specs.Util;
|
||||
using Path = Bleroy.FluentPath.Path;
|
||||
@@ -10,6 +14,7 @@ namespace Orchard.Specs.Hosting {
|
||||
private WebHostAgent _webHostAgent;
|
||||
private Path _tempSite;
|
||||
private Path _orchardWebPath;
|
||||
private Path _codeGenDir;
|
||||
|
||||
public WebHost(Path orchardTemp) {
|
||||
_orchardTemp = orchardTemp;
|
||||
@@ -60,6 +65,17 @@ namespace Orchard.Specs.Hosting {
|
||||
|
||||
_webHostAgent = (WebHostAgent)ApplicationHost.CreateApplicationHost(typeof(WebHostAgent), VirtualDirectory, PhysicalDirectory);
|
||||
|
||||
var shuttle = new Shuttle();
|
||||
Execute(() => { shuttle.CodeGenDir = HttpRuntime.CodegenDir; });
|
||||
|
||||
// ASP.NET folder seems to be always nested into an empty directory
|
||||
_codeGenDir = shuttle.CodeGenDir;
|
||||
_codeGenDir = _codeGenDir.Parent;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
class Shuttle {
|
||||
public string CodeGenDir;
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
@@ -71,10 +87,42 @@ namespace Orchard.Specs.Hosting {
|
||||
}
|
||||
|
||||
public void Clean() {
|
||||
// Try to delete temporary files for up to ~1.2 seconds.
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Trace.WriteLine("Waiting 300msec before trying to delete temporary files");
|
||||
Thread.Sleep(300);
|
||||
|
||||
if (TryDeleteTempFiles()) {
|
||||
Trace.WriteLine("Successfully deleted all temporary files");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryDeleteTempFiles() {
|
||||
var result = true;
|
||||
if (_codeGenDir != null && _codeGenDir.Exists) {
|
||||
Trace.WriteLine(string.Format("Trying to delete temporary files at '{0}", _codeGenDir));
|
||||
try {
|
||||
_codeGenDir.Delete(true); // <- clean as much as possible
|
||||
}
|
||||
catch(Exception e) {
|
||||
Trace.WriteLine(string.Format("failure: '{0}", e));
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_tempSite != null && _tempSite.Exists)
|
||||
try {
|
||||
Trace.WriteLine(string.Format("Trying to delete temporary files at '{0}", _tempSite));
|
||||
_tempSite.Delete(true); // <- progressively clean as much as possible
|
||||
}
|
||||
catch { }
|
||||
catch (Exception e) {
|
||||
Trace.WriteLine(string.Format("failure: '{0}", e));
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void CopyExtension(string extensionFolder, string extensionName, ExtensionDeploymentOptions deploymentOptions) {
|
||||
|
@@ -3,7 +3,6 @@
|
||||
As a root Orchard system operator
|
||||
I want to create and manage tenant configurations
|
||||
|
||||
@ignore
|
||||
Scenario: Default site is listed
|
||||
Given I have installed Orchard
|
||||
And I have installed "Orchard.MultiTenancy"
|
||||
@@ -115,7 +114,6 @@ Scenario: An existing initialized tenant cannot have its database option cleared
|
||||
And I should see "<h2>Scott</h2>"
|
||||
And I should not see "Allow the tenant to set up the database"
|
||||
|
||||
@ignore
|
||||
Scenario: Default tenant cannot be disabled
|
||||
Given I have installed Orchard
|
||||
And I have installed "Orchard.MultiTenancy"
|
||||
@@ -166,7 +164,6 @@ Scenario: A running tenant which is disabled can be enabled
|
||||
And I am redirected
|
||||
Then I should see "<form action="/Admin/MultiTenancy/disable""
|
||||
|
||||
@ignore
|
||||
Scenario: Listing tenants from command line
|
||||
Given I have installed Orchard
|
||||
And I have installed "Orchard.MultiTenancy"
|
||||
|
248
src/Orchard.Specs/MultiTenancy.feature.cs
generated
248
src/Orchard.Specs/MultiTenancy.feature.cs
generated
@@ -55,24 +55,22 @@ namespace Orchard.Specs
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Default site is listed")]
|
||||
[NUnit.Framework.IgnoreAttribute()]
|
||||
public virtual void DefaultSiteIsListed()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default site is listed", new string[] {
|
||||
"ignore"});
|
||||
#line 7
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default site is listed", ((string[])(null)));
|
||||
#line 6
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 8
|
||||
#line 7
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 9
|
||||
#line 8
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 10
|
||||
#line 9
|
||||
testRunner.When("I go to \"Admin/MultiTenancy\"");
|
||||
#line 11
|
||||
#line 10
|
||||
testRunner.Then("I should see \"List of Site's Tenants\"");
|
||||
#line 12
|
||||
#line 11
|
||||
testRunner.And("I should see \"<h3>Default</h3>\"");
|
||||
#line 13
|
||||
#line 12
|
||||
testRunner.And("the status should be 200 \"OK\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -83,17 +81,17 @@ testRunner.And("the status should be 200 \"OK\"");
|
||||
public virtual void NewTenantFieldsAreRequired()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("New tenant fields are required", ((string[])(null)));
|
||||
#line 15
|
||||
#line 14
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 16
|
||||
#line 15
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 17
|
||||
#line 16
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 18
|
||||
#line 17
|
||||
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
#line 19
|
||||
#line 18
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 20
|
||||
#line 19
|
||||
testRunner.Then("I should see \"is required\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -104,13 +102,13 @@ testRunner.Then("I should see \"is required\"");
|
||||
public virtual void ANewTenantIsCreated()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant is created", ((string[])(null)));
|
||||
#line 22
|
||||
#line 21
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 23
|
||||
#line 22
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 24
|
||||
#line 23
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 25
|
||||
#line 24
|
||||
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -119,15 +117,15 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
table1.AddRow(new string[] {
|
||||
"Name",
|
||||
"Scott"});
|
||||
#line 26
|
||||
#line 25
|
||||
testRunner.And("I fill in", ((string)(null)), table1);
|
||||
#line 29
|
||||
#line 28
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 30
|
||||
#line 29
|
||||
testRunner.And("I am redirected");
|
||||
#line 31
|
||||
#line 30
|
||||
testRunner.Then("I should see \"<h3>Scott</h3>\"");
|
||||
#line 32
|
||||
#line 31
|
||||
testRunner.And("the status should be 200 \"OK\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -138,13 +136,13 @@ testRunner.And("the status should be 200 \"OK\"");
|
||||
public virtual void ANewTenantIsCreatedWithUninitializedState()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant is created with uninitialized state", ((string[])(null)));
|
||||
#line 34
|
||||
#line 33
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 35
|
||||
#line 34
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 36
|
||||
#line 35
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 37
|
||||
#line 36
|
||||
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -153,15 +151,15 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
table2.AddRow(new string[] {
|
||||
"Name",
|
||||
"Scott"});
|
||||
#line 38
|
||||
#line 37
|
||||
testRunner.And("I fill in", ((string)(null)), table2);
|
||||
#line 41
|
||||
#line 40
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 42
|
||||
#line 41
|
||||
testRunner.And("I am redirected");
|
||||
#line 43
|
||||
#line 42
|
||||
testRunner.Then("I should see \"<li class=\"tenant Uninitialized\">\"");
|
||||
#line 44
|
||||
#line 43
|
||||
testRunner.And("the status should be 200 \"OK\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -172,13 +170,13 @@ testRunner.And("the status should be 200 \"OK\"");
|
||||
public virtual void ANewTenantGoesToTheSetupScreen()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant goes to the setup screen", ((string[])(null)));
|
||||
#line 46
|
||||
#line 45
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 47
|
||||
#line 46
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 48
|
||||
#line 47
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 49
|
||||
#line 48
|
||||
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -190,17 +188,17 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
table3.AddRow(new string[] {
|
||||
"RequestUrlHost",
|
||||
"scott.example.org"});
|
||||
#line 50
|
||||
#line 49
|
||||
testRunner.And("I fill in", ((string)(null)), table3);
|
||||
#line 54
|
||||
#line 53
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 55
|
||||
#line 54
|
||||
testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||
#line 56
|
||||
#line 55
|
||||
testRunner.Then("I should see \"Welcome to Orchard\"");
|
||||
#line 57
|
||||
#line 56
|
||||
testRunner.And("I should see \"Finish Setup\"");
|
||||
#line 58
|
||||
#line 57
|
||||
testRunner.And("the status should be 200 \"OK\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -211,13 +209,13 @@ testRunner.And("the status should be 200 \"OK\"");
|
||||
public virtual void ANewTenantWithPreconfiguredDatabaseGoesToTheSetupScreen()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant with preconfigured database goes to the setup screen", ((string[])(null)));
|
||||
#line 60
|
||||
#line 59
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 61
|
||||
#line 60
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 62
|
||||
#line 61
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 63
|
||||
#line 62
|
||||
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -232,21 +230,21 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
table4.AddRow(new string[] {
|
||||
"DataProvider",
|
||||
"SqlCe"});
|
||||
#line 64
|
||||
#line 63
|
||||
testRunner.And("I fill in", ((string)(null)), table4);
|
||||
#line 69
|
||||
#line 68
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 70
|
||||
#line 69
|
||||
testRunner.And("I am redirected");
|
||||
#line 71
|
||||
#line 70
|
||||
testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||
#line 72
|
||||
#line 71
|
||||
testRunner.Then("I should see \"Welcome to Orchard\"");
|
||||
#line 73
|
||||
#line 72
|
||||
testRunner.And("I should see \"Finish Setup\"");
|
||||
#line 74
|
||||
#line 73
|
||||
testRunner.And("I should not see \"SQL Server Compact\"");
|
||||
#line 75
|
||||
#line 74
|
||||
testRunner.And("the status should be 200 \"OK\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -257,13 +255,13 @@ testRunner.And("the status should be 200 \"OK\"");
|
||||
public virtual void ANewTenantRunsTheSetup()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant runs the setup", ((string[])(null)));
|
||||
#line 77
|
||||
#line 76
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 78
|
||||
#line 77
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 79
|
||||
#line 78
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 80
|
||||
#line 79
|
||||
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -275,11 +273,11 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
table5.AddRow(new string[] {
|
||||
"RequestUrlHost",
|
||||
"scott.example.org"});
|
||||
#line 81
|
||||
#line 80
|
||||
testRunner.And("I fill in", ((string)(null)), table5);
|
||||
#line 85
|
||||
#line 84
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 86
|
||||
#line 85
|
||||
testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -294,15 +292,15 @@ testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||
table6.AddRow(new string[] {
|
||||
"ConfirmPassword",
|
||||
"6655321"});
|
||||
#line 87
|
||||
#line 86
|
||||
testRunner.And("I fill in", ((string)(null)), table6);
|
||||
#line 92
|
||||
#line 91
|
||||
testRunner.And("I hit \"Finish Setup\"");
|
||||
#line 93
|
||||
#line 92
|
||||
testRunner.And("I go to \"/Default.aspx\"");
|
||||
#line 94
|
||||
#line 93
|
||||
testRunner.Then("I should see \"Scott Site\"");
|
||||
#line 95
|
||||
#line 94
|
||||
testRunner.And("I should see \"Welcome\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -313,13 +311,13 @@ testRunner.And("I should see \"Welcome\"");
|
||||
public virtual void AnExistingInitializedTenantCannotHaveItsDatabaseOptionCleared()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("An existing initialized tenant cannot have its database option cleared", ((string[])(null)));
|
||||
#line 97
|
||||
#line 96
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 98
|
||||
#line 97
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 99
|
||||
#line 98
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 100
|
||||
#line 99
|
||||
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -331,11 +329,11 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
table7.AddRow(new string[] {
|
||||
"RequestUrlHost",
|
||||
"scott.example.org"});
|
||||
#line 101
|
||||
#line 100
|
||||
testRunner.And("I fill in", ((string)(null)), table7);
|
||||
#line 105
|
||||
#line 104
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 106
|
||||
#line 105
|
||||
testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -350,17 +348,17 @@ testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||
table8.AddRow(new string[] {
|
||||
"ConfirmPassword",
|
||||
"6655321"});
|
||||
#line 107
|
||||
#line 106
|
||||
testRunner.And("I fill in", ((string)(null)), table8);
|
||||
#line 112
|
||||
#line 111
|
||||
testRunner.And("I hit \"Finish Setup\"");
|
||||
#line 113
|
||||
#line 112
|
||||
testRunner.And("I go to \"/Admin/MultiTenancy/Edit/Scott\" on host localhost");
|
||||
#line 114
|
||||
#line 113
|
||||
testRunner.Then("I should see \"<h1>Edit Tenant</h1>\"");
|
||||
#line 115
|
||||
#line 114
|
||||
testRunner.And("I should see \"<h2>Scott</h2>\"");
|
||||
#line 116
|
||||
#line 115
|
||||
testRunner.And("I should not see \"Allow the tenant to set up the database\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -368,20 +366,18 @@ testRunner.And("I should not see \"Allow the tenant to set up the database\"");
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Default tenant cannot be disabled")]
|
||||
[NUnit.Framework.IgnoreAttribute()]
|
||||
public virtual void DefaultTenantCannotBeDisabled()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default tenant cannot be disabled", new string[] {
|
||||
"ignore"});
|
||||
#line 119
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default tenant cannot be disabled", ((string[])(null)));
|
||||
#line 117
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 120
|
||||
#line 118
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 121
|
||||
#line 119
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 122
|
||||
#line 120
|
||||
testRunner.When("I go to \"Admin/MultiTenancy\"");
|
||||
#line 123
|
||||
#line 121
|
||||
testRunner.Then("I should not see \"<form action=\"/Admin/MultiTenancy/disable\"\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -392,13 +388,13 @@ testRunner.Then("I should not see \"<form action=\"/Admin/MultiTenancy/disable\"
|
||||
public virtual void ARunningTenantCanBeDisabled()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A running tenant can be disabled", ((string[])(null)));
|
||||
#line 125
|
||||
#line 123
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 126
|
||||
#line 124
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 127
|
||||
#line 125
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 128
|
||||
#line 126
|
||||
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -410,11 +406,11 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
table9.AddRow(new string[] {
|
||||
"RequestUrlHost",
|
||||
"scott.example.org"});
|
||||
#line 129
|
||||
#line 127
|
||||
testRunner.And("I fill in", ((string)(null)), table9);
|
||||
#line 133
|
||||
#line 131
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 134
|
||||
#line 132
|
||||
testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -429,17 +425,17 @@ testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||
table10.AddRow(new string[] {
|
||||
"ConfirmPassword",
|
||||
"6655321"});
|
||||
#line 135
|
||||
#line 133
|
||||
testRunner.And("I fill in", ((string)(null)), table10);
|
||||
#line 140
|
||||
#line 138
|
||||
testRunner.And("I hit \"Finish Setup\"");
|
||||
#line 141
|
||||
#line 139
|
||||
testRunner.And("I go to \"/Admin/MultiTenancy\" on host localhost");
|
||||
#line 142
|
||||
#line 140
|
||||
testRunner.And("I hit \"Suspend\"");
|
||||
#line 143
|
||||
#line 141
|
||||
testRunner.And("I am redirected");
|
||||
#line 144
|
||||
#line 142
|
||||
testRunner.Then("I should see \"<form action=\"/Admin/MultiTenancy/enable\"\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -450,13 +446,13 @@ testRunner.Then("I should see \"<form action=\"/Admin/MultiTenancy/enable\"\"");
|
||||
public virtual void ARunningTenantWhichIsDisabledCanBeEnabled()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A running tenant which is disabled can be enabled", ((string[])(null)));
|
||||
#line 146
|
||||
#line 144
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 147
|
||||
#line 145
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 148
|
||||
#line 146
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 149
|
||||
#line 147
|
||||
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -468,11 +464,11 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||
table11.AddRow(new string[] {
|
||||
"RequestUrlHost",
|
||||
"scott.example.org"});
|
||||
#line 150
|
||||
#line 148
|
||||
testRunner.And("I fill in", ((string)(null)), table11);
|
||||
#line 154
|
||||
#line 152
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 155
|
||||
#line 153
|
||||
testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -487,21 +483,21 @@ testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||
table12.AddRow(new string[] {
|
||||
"ConfirmPassword",
|
||||
"6655321"});
|
||||
#line 156
|
||||
#line 154
|
||||
testRunner.And("I fill in", ((string)(null)), table12);
|
||||
#line 161
|
||||
#line 159
|
||||
testRunner.And("I hit \"Finish Setup\"");
|
||||
#line 162
|
||||
#line 160
|
||||
testRunner.And("I go to \"/Admin/MultiTenancy\" on host localhost");
|
||||
#line 163
|
||||
#line 161
|
||||
testRunner.And("I hit \"Suspend\"");
|
||||
#line 162
|
||||
testRunner.And("I am redirected");
|
||||
#line 163
|
||||
testRunner.And("I hit \"Resume\"");
|
||||
#line 164
|
||||
testRunner.And("I am redirected");
|
||||
#line 165
|
||||
testRunner.And("I hit \"Resume\"");
|
||||
#line 166
|
||||
testRunner.And("I am redirected");
|
||||
#line 167
|
||||
testRunner.Then("I should see \"<form action=\"/Admin/MultiTenancy/disable\"\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
@@ -509,24 +505,22 @@ testRunner.Then("I should see \"<form action=\"/Admin/MultiTenancy/disable\"\"")
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Listing tenants from command line")]
|
||||
[NUnit.Framework.IgnoreAttribute()]
|
||||
public virtual void ListingTenantsFromCommandLine()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Listing tenants from command line", new string[] {
|
||||
"ignore"});
|
||||
#line 170
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Listing tenants from command line", ((string[])(null)));
|
||||
#line 167
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 171
|
||||
#line 168
|
||||
testRunner.Given("I have installed Orchard");
|
||||
#line 172
|
||||
#line 169
|
||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||
#line 173
|
||||
#line 170
|
||||
testRunner.And("I have tenant \"Alpha\" on \"example.org\" as \"New-site-name\"");
|
||||
#line 174
|
||||
#line 171
|
||||
testRunner.When("I execute >tenant list");
|
||||
#line 175
|
||||
#line 172
|
||||
testRunner.Then("I should see \"Name: Alpha\"");
|
||||
#line 176
|
||||
#line 173
|
||||
testRunner.And("I should see \"Request Url Host: example.org\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
|
@@ -220,6 +220,7 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Hosting\Orchard.Web\Web.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Hosting\Orchard.Web\Core\Web.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
|
@@ -0,0 +1,211 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Autofac;
|
||||
using JetBrains.Annotations;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Comments.Handlers;
|
||||
using Orchard.Comments.Models;
|
||||
using Orchard.Comments.Services;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.Records;
|
||||
using Orchard.Core.Common.Handlers;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Data;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.DisplayManagement.Descriptors;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Security;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.Tests.Modules.Comments.Services {
|
||||
[TestFixture]
|
||||
public class CommentServiceTests : DatabaseEnabledTestsBase {
|
||||
private IContentManager _contentManager;
|
||||
private ICommentService _commentService;
|
||||
|
||||
public override void Register(ContainerBuilder builder) {
|
||||
builder.RegisterType<CommentService>().As<ICommentService>();
|
||||
builder.RegisterType<StubCommentValidator>().As<ICommentValidator>();
|
||||
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
||||
builder.RegisterInstance(new Mock<ITransactionManager>().Object);
|
||||
builder.RegisterInstance(new Mock<IAuthorizer>().Object);
|
||||
builder.RegisterInstance(new Mock<INotifier>().Object);
|
||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||
builder.RegisterInstance(new Mock<IAuthenticationService>().Object);
|
||||
builder.RegisterType<OrchardServices>().As<IOrchardServices>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<StubWorkContextAccessor>().As<IWorkContextAccessor>();
|
||||
builder.RegisterType<CommentedItemHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<DefaultContentQuery>().As<IContentQuery>();
|
||||
builder.RegisterType<CommentPartHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<CommonPartHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterType<DefaultContentDisplay>().As<IContentDisplay>();
|
||||
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
|
||||
}
|
||||
|
||||
public override void Init() {
|
||||
base.Init();
|
||||
_commentService = _container.Resolve<ICommentService>();
|
||||
_contentManager = _container.Resolve<IContentManager>();
|
||||
}
|
||||
|
||||
|
||||
protected override IEnumerable<Type> DatabaseTypes {
|
||||
get {
|
||||
return new[] {
|
||||
typeof(CommentPartRecord),
|
||||
typeof(ContentItemRecord),
|
||||
typeof(ContentItemVersionRecord),
|
||||
typeof(ContentTypeRecord),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CommentedItemShouldHaveACommentPart() {
|
||||
var commentedItem = _contentManager.New("commentedItem");
|
||||
_contentManager.Create(commentedItem);
|
||||
_contentManager.Create(commentedItem, VersionOptions.Published);
|
||||
|
||||
Assert.That(commentedItem.As<CommentPart>(), Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetCommentsShouldReturnAllComments() {
|
||||
for (int i = 0; i < 12; i++) {
|
||||
var commentedItem = _contentManager.New("commentedItem");
|
||||
_contentManager.Create(commentedItem);
|
||||
_contentManager.Create(commentedItem, VersionOptions.Published);
|
||||
|
||||
}
|
||||
|
||||
Assert.That(_commentService.GetComments().Count(), Is.EqualTo(12));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetCommentedContentShouldReturnCommentedContentItem() {
|
||||
var commentedItem = _contentManager.New("commentedItem");
|
||||
_contentManager.Create(commentedItem);
|
||||
_contentManager.Create(commentedItem, VersionOptions.Published);
|
||||
int commentId = commentedItem.As<CommentPart>().Id;
|
||||
|
||||
Assert.That(_commentService.GetCommentedContent(commentId), Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdateShouldChangeComment() {
|
||||
var commentedItem = _contentManager.New("commentedItem");
|
||||
_contentManager.Create(commentedItem);
|
||||
_contentManager.Create(commentedItem, VersionOptions.Published);
|
||||
int commentId = commentedItem.As<CommentPart>().Id;
|
||||
|
||||
Assert.That(_commentService.GetComment(commentId).Record.Author, Is.Null.Or.Empty);
|
||||
|
||||
_commentService.UpdateComment(commentId, "test", "", "", "new text", CommentStatus.Pending);
|
||||
|
||||
Assert.That(_commentService.GetComment(commentId).Record.Author, Is.EqualTo("test"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CommentsShouldBePendingByDefault() {
|
||||
var commentedItem = _contentManager.New("commentedItem");
|
||||
_contentManager.Create(commentedItem);
|
||||
_contentManager.Create(commentedItem, VersionOptions.Published);
|
||||
int commentId = commentedItem.As<CommentPart>().Id;
|
||||
|
||||
Assert.That(_commentService.GetComment(commentId).Record.Status, Is.EqualTo(CommentStatus.Pending));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ApproveShouldUpdateCommentStatus() {
|
||||
var commentedItem = _contentManager.New("commentedItem");
|
||||
_contentManager.Create(commentedItem);
|
||||
_contentManager.Create(commentedItem, VersionOptions.Published);
|
||||
int commentId = commentedItem.As<CommentPart>().Id;
|
||||
_commentService.ApproveComment(commentId);
|
||||
|
||||
Assert.That(_commentService.GetComment(commentId).Record.Status, Is.EqualTo(CommentStatus.Approved));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UnapproveShouldPendComment() {
|
||||
var commentedItem = _contentManager.New("commentedItem");
|
||||
_contentManager.Create(commentedItem);
|
||||
_contentManager.Create(commentedItem, VersionOptions.Published);
|
||||
int commentId = commentedItem.As<CommentPart>().Id;
|
||||
_commentService.ApproveComment(commentId);
|
||||
|
||||
Assert.That(_commentService.GetComment(commentId).Record.Status, Is.EqualTo(CommentStatus.Approved));
|
||||
|
||||
_commentService.UnapproveComment(commentId);
|
||||
|
||||
Assert.That(_commentService.GetComment(commentId).Record.Status, Is.EqualTo(CommentStatus.Pending));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MarkAsSpamShouldFlagComments() {
|
||||
var commentedItem = _contentManager.New("commentedItem");
|
||||
_contentManager.Create(commentedItem);
|
||||
_contentManager.Create(commentedItem, VersionOptions.Published);
|
||||
int commentId = commentedItem.As<CommentPart>().Id;
|
||||
_commentService.ApproveComment(commentId);
|
||||
|
||||
Assert.That(_commentService.GetComment(commentId).Record.Status, Is.EqualTo(CommentStatus.Approved));
|
||||
|
||||
_commentService.MarkCommentAsSpam(commentId);
|
||||
|
||||
Assert.That(_commentService.GetComment(commentId).Record.Status, Is.EqualTo(CommentStatus.Spam));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeleteShouldRemoveComments() {
|
||||
var commentIds = new int[12];
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
var commentedItem = _contentManager.New("commentedItem");
|
||||
_contentManager.Create(commentedItem);
|
||||
_contentManager.Create(commentedItem, VersionOptions.Published);
|
||||
commentIds[i] = commentedItem.As<CommentPart>().Id;
|
||||
}
|
||||
|
||||
Assert.That(_commentService.GetComments().Count(), Is.EqualTo(12));
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
_commentService.DeleteComment(commentIds[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public class CommentedItemHandler : ContentHandler {
|
||||
public CommentedItemHandler() {
|
||||
Filters.Add(new ActivatingFilter<CommentedItem>("commentedItem"));
|
||||
Filters.Add(new ActivatingFilter<CommentPart>("commentedItem"));
|
||||
Filters.Add(new ActivatingFilter<CommonPart>("commentedItem"));
|
||||
}
|
||||
}
|
||||
|
||||
public class CommentedItem : ContentPart {
|
||||
}
|
||||
|
||||
public class CommentedItemDriver : ContentPartDriver<CommentedItem> {
|
||||
public static readonly string ContentTypeName = "commentedItem";
|
||||
}
|
||||
|
||||
public class StubCommentValidator : ICommentValidator {
|
||||
public bool ValidateComment(CommentPart commentPart) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@@ -135,6 +135,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CodeGeneration\Commands\CodeGenerationCommandsTests.cs" />
|
||||
<Compile Include="Comments\Services\CommentServiceTests.cs" />
|
||||
<Compile Include="Scripting\EvaluatorTests.cs" />
|
||||
<Compile Include="Scripting\ParserTests.cs" />
|
||||
<Compile Include="Scripting\TokenizerTests.cs" />
|
||||
@@ -179,6 +180,10 @@
|
||||
<Project>{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}</Project>
|
||||
<Name>Orchard.CodeGeneration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Web\Modules\Orchard.Comments\Orchard.Comments.csproj">
|
||||
<Project>{14C049FD-B35B-415A-A824-87F26B26E7FD}</Project>
|
||||
<Name>Orchard.Comments</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Web\Modules\Orchard.Media\Orchard.Media.csproj">
|
||||
<Project>{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB}</Project>
|
||||
<Name>Orchard.Media</Name>
|
||||
@@ -252,6 +257,7 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Packaging\Hello.World.csproj.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@@ -207,27 +207,21 @@ namespace Orchard.Tests.Events {
|
||||
}
|
||||
public class StubEventHandler2 : ITestEventHandler {
|
||||
public void Increment() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Sum(int a) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Sum(int a, int b) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Sum(int a, int b, int c) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Substract(int a, int b) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Concat(string a, string b, string c) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<string> Gather(int a, string b) {
|
||||
|
@@ -29,7 +29,7 @@ namespace Orchard.Blogs.Drivers {
|
||||
|
||||
protected override DriverResult Editor(BlogArchivesPart part, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_Blogs_BlogArchives_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Blogs.BlogArchives", Model: part, Prefix: Prefix));
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Blogs.BlogArchives", Model: part, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(BlogArchivesPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
|
@@ -65,7 +65,7 @@ namespace Orchard.Blogs.Drivers {
|
||||
|
||||
protected override DriverResult Editor(BlogPart blogPart, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_Blogs_Blog_Fields",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Blogs.Blog.Fields", Model: blogPart, Prefix: Prefix));
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Blogs.Blog.Fields", Model: blogPart, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(BlogPart blogPart, IUpdateModel updater, dynamic shapeHelper) {
|
||||
|
@@ -48,7 +48,7 @@ namespace Orchard.Blogs.Drivers {
|
||||
|
||||
protected override DriverResult Editor(RecentBlogPostsPart part, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_Blogs_RecentBlogPosts_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Blogs.RecentBlogPosts", Model: part, Prefix: Prefix));
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Blogs.RecentBlogPosts", Model: part, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(RecentBlogPostsPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
|
@@ -116,13 +116,13 @@
|
||||
<Content Include="Views\BlogPost\ListByArchive.cshtml" />
|
||||
<Content Include="Views\Blog\Item.cshtml" />
|
||||
<Content Include="Views\Blog\List.cshtml" />
|
||||
<Content Include="Views\Parts\Blogs.Blog.Manage.cshtml" />
|
||||
<Content Include="Views\Parts\Blogs.Blog.Description.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Blogs.Blog.Fields.cshtml" />
|
||||
<Content Include="Views\Parts\Blogs.BlogPost.ListAdmin.cshtml">
|
||||
<Content Include="Views\Parts.Blogs.Blog.Manage.cshtml" />
|
||||
<Content Include="Views\Parts.Blogs.Blog.Description.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts.Blogs.Blog.Fields.cshtml" />
|
||||
<Content Include="Views\Parts.Blogs.BlogPost.ListAdmin.cshtml">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="Views\Items\Content-Blog.SummaryAdmin.cshtml" />
|
||||
<Content Include="Views\Content-Blog.SummaryAdmin.cshtml" />
|
||||
<Content Include="Views\Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -139,15 +139,15 @@
|
||||
<Content Include="Placement.info">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Views\Parts\Blogs.RemotePublishing.cshtml" />
|
||||
<Content Include="Views\Parts\Blogs.BlogArchives.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Blogs.RecentBlogPosts.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Blogs.BlogArchives.cshtml" />
|
||||
<Content Include="Views\Items\Content-Blog.DetailAdmin.cshtml" />
|
||||
<Content Include="Views\Items\Content-Blog.Edit.cshtml" />
|
||||
<Content Include="Views\Parts\Blogs.BlogPost.List.cshtml" />
|
||||
<Content Include="Views\Parts\Blogs.RecentBlogPosts.cshtml" />
|
||||
<Content Include="Views\Parts\Blogs.Blog.BlogPostCount.cshtml" />
|
||||
<Content Include="Views\Parts.Blogs.RemotePublishing.cshtml" />
|
||||
<Content Include="Views\Parts.Blogs.BlogArchives.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts.Blogs.RecentBlogPosts.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts.Blogs.BlogArchives.cshtml" />
|
||||
<Content Include="Views\Content-Blog.DetailAdmin.cshtml" />
|
||||
<Content Include="Views\Content-Blog.Edit.cshtml" />
|
||||
<Content Include="Views\Parts.Blogs.BlogPost.List.cshtml" />
|
||||
<Content Include="Views\Parts.Blogs.RecentBlogPosts.cshtml" />
|
||||
<Content Include="Views\Parts.Blogs.Blog.BlogPostCount.cshtml" />
|
||||
<Content Include="Scripts\Web.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
|
@@ -15,7 +15,7 @@ namespace Orchard.Comments.Drivers {
|
||||
|
||||
protected override DriverResult Editor(CommentSettingsPart part, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_Comments_SiteSettings",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Comments.SiteSettings", Model: part.Record, Prefix: Prefix));
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Comments.SiteSettings", Model: part.Record, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(CommentSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
|
@@ -22,7 +22,7 @@ namespace Orchard.Comments.Drivers {
|
||||
|
||||
protected override DriverResult Editor(CommentsPart part, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_Comments_Enable",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Comments.Comments", Model: part, Prefix: Prefix));
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Comments.Comments", Model: part, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(CommentsPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
|
@@ -1,8 +1,6 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Comments.Drivers;
|
||||
using Orchard.Comments.Models;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Data;
|
||||
|
||||
namespace Orchard.Comments.Handlers {
|
||||
|
@@ -115,11 +115,11 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Admin\Edit.cshtml" />
|
||||
<Content Include="Views\Admin\Index.cshtml" />
|
||||
<Content Include="Views\Parts\Comments.cshtml" />
|
||||
<Content Include="Views\Parts\Comments.Count.cshtml" />
|
||||
<Content Include="Views\Parts\Comments.Count.SummaryAdmin.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Comments.Comments.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Comments.SiteSettings.cshtml" />
|
||||
<Content Include="Views\Parts.Comments.cshtml" />
|
||||
<Content Include="Views\Parts.Comments.Count.cshtml" />
|
||||
<Content Include="Views\Parts.Comments.Count.SummaryAdmin.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts.Comments.Comments.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts.Comments.SiteSettings.cshtml" />
|
||||
<Content Include="Views\ListOfComments.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -132,6 +132,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
@@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
@@ -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;
|
||||
|
@@ -28,7 +28,7 @@ namespace Orchard.Widgets.Drivers {
|
||||
|
||||
protected override DriverResult Editor(LayerPart layerPart, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_Widgets_LayerPart",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Widgets.LayerPart", Model: layerPart, Prefix: Prefix));
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Widgets.LayerPart", Model: layerPart, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(LayerPart layerPart, IUpdateModel updater, dynamic shapeHelper) {
|
||||
|
@@ -20,7 +20,7 @@ namespace Orchard.Widgets.Drivers {
|
||||
widgetPart.AvailableLayers = _widgetsService.GetLayers();
|
||||
|
||||
return ContentShape("Parts_Widgets_WidgetPart",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Widgets.WidgetPart", Model: widgetPart, Prefix: Prefix));
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Widgets.WidgetPart", Model: widgetPart, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(WidgetPart widgetPart, IUpdateModel updater, dynamic shapeHelper) {
|
||||
|
@@ -105,13 +105,10 @@
|
||||
<Content Include="Views\Admin\EditWidget.cshtml" />
|
||||
<Content Include="Views\Admin\EditLayer.cshtml" />
|
||||
<Content Include="Views\Admin\Index.cshtml" />
|
||||
<Content Include="Views\Items\Widget.Edit.cshtml" />
|
||||
<Content Include="Views\Items\Widget.cshtml" />
|
||||
<Content Include="Views\Widget.Edit.cshtml" />
|
||||
<Content Include="Views\Widget.cshtml" />
|
||||
<Content Include="Views\Widget.ControlWrapper.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Widgets.WidgetPart.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Widgets.LayerPart.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Widgets.WidgetBagPart.cshtml" />
|
||||
<Content Include="Views\Items\Content-WidgetPage.cshtml" />
|
||||
<Content Include="Views\Content-WidgetPage.cshtml" />
|
||||
<Content Include="Views\Widget.Wrapper.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -124,6 +121,15 @@
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Content-WidgetPage.cshtml" />
|
||||
<Content Include="Views\Widget.cshtml" />
|
||||
<Content Include="Views\Widget.Edit.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\EditorTemplates\Parts.Widgets.LayerPart.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts.Widgets.WidgetPart.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@@ -1,8 +0,0 @@
|
||||
@{
|
||||
Style.Require("WidgetsAdmin");
|
||||
}
|
||||
<div class="widgetsbag-editor">
|
||||
<h5>@T("Widgets")</h5>
|
||||
@* todo: (heskew) either embed some widget management here or link to a more specific widget management URL that's a little more specific to managing widgets for the Content zone for this item *@
|
||||
<p>@T("Manage content widgets with the {0}.", @Html.ActionLink(T("widget manager").Text, "Index", "Admin", new {area = "Orchard.Widgets"}, null))</p>
|
||||
</div>
|
@@ -31,7 +31,7 @@
|
||||
var firstLevelTag = Tag(firstLevelMenuItem, "li");
|
||||
@firstLevelTag.StartElement
|
||||
<h3>@sectionHeaderMarkup</h3>
|
||||
if (secondLevelMenuItems.Count() > 1) {
|
||||
if (secondLevelMenuItems.Count() > 1 || !firstLevelMenuItem.LinkToFirstChild) {
|
||||
<ul class="menuItems">
|
||||
@foreach(var secondLevelMenuItem in secondLevelMenuItems) {
|
||||
<li>
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Orchard.Environment;
|
||||
using System;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
|
||||
namespace Orchard.Data.Migration {
|
||||
@@ -21,18 +22,30 @@ namespace Orchard.Data.Migration {
|
||||
_dataMigrationManager = dataMigrationManager;
|
||||
}
|
||||
|
||||
public void Install(Feature feature) {
|
||||
public void Installing(Feature feature) {
|
||||
var featureName = feature.Descriptor.Id;
|
||||
_dataMigrationManager.Update(featureName);
|
||||
}
|
||||
|
||||
public void Enable(Feature feature) {
|
||||
public void Installed(Feature feature) {
|
||||
}
|
||||
|
||||
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) {
|
||||
var featureName = feature.Descriptor.Id;
|
||||
if ( _dataMigrationManager.IsFeatureAlreadyInstalled(featureName) ) {
|
||||
_dataMigrationManager.Uninstall(featureName);
|
||||
|
@@ -59,7 +59,6 @@ namespace Orchard.Data.Migration {
|
||||
}
|
||||
|
||||
public void Update(string feature){
|
||||
|
||||
Logger.Information("Updating feature: {0}", feature);
|
||||
|
||||
// proceed with dependent features first, whatever the module it's in
|
||||
@@ -125,6 +124,8 @@ namespace Orchard.Data.Migration {
|
||||
}
|
||||
|
||||
public void Uninstall(string feature) {
|
||||
Logger.Information("Uninstalling feature: {0}", feature);
|
||||
|
||||
var migrations = GetDataMigrations(feature);
|
||||
|
||||
// apply update methods to each migration class for the module
|
||||
|
@@ -147,6 +147,8 @@ namespace Orchard.Environment {
|
||||
}
|
||||
|
||||
private void DisposeShellContext() {
|
||||
Logger.Information("Disposing active shell contexts");
|
||||
|
||||
if (_current != null) {
|
||||
foreach (var shellContext in _current) {
|
||||
shellContext.Shell.Terminate();
|
||||
@@ -160,24 +162,13 @@ namespace Orchard.Environment {
|
||||
BuildCurrent();
|
||||
}
|
||||
|
||||
|
||||
// the exit gate is temporary, until better control strategy is in place
|
||||
private readonly ManualResetEvent _exitGate = new ManualResetEvent(true);
|
||||
|
||||
protected virtual void EndRequest() {
|
||||
if (_processingEngine.AreTasksPending()) {
|
||||
_exitGate.Reset();
|
||||
ThreadPool.QueueUserWorkItem(state => {
|
||||
while (_processingEngine.AreTasksPending()) {
|
||||
_processingEngine.ExecuteNextTask();
|
||||
if (!_processingEngine.AreTasksPending()) {
|
||||
_exitGate.Set();
|
||||
}
|
||||
}
|
||||
});
|
||||
// Synchronously process all pending tasks. It's safe to do this at this point
|
||||
// of the pipeline, as the request transaction has been closed, so creating a new
|
||||
// environment and transaction for these tasks will behave as expected.
|
||||
while (_processingEngine.AreTasksPending()) {
|
||||
_processingEngine.ExecuteNextTask();
|
||||
}
|
||||
|
||||
_exitGate.WaitOne(250);
|
||||
}
|
||||
|
||||
void IShellSettingsManagerEventHandler.Saved(ShellSettings settings) {
|
||||
|
@@ -8,9 +8,13 @@ namespace Orchard.Environment {
|
||||
}
|
||||
|
||||
public interface IFeatureEventHandler : IEventHandler {
|
||||
void Install(Feature feature);
|
||||
void Enable(Feature feature);
|
||||
void Disable(Feature feature);
|
||||
void Uninstall(Feature feature);
|
||||
void Installing(Feature feature);
|
||||
void Installed(Feature feature);
|
||||
void Enabling(Feature feature);
|
||||
void Enabled(Feature feature);
|
||||
void Disabling(Feature feature);
|
||||
void Disabled(Feature feature);
|
||||
void Uninstalling(Feature feature);
|
||||
void Uninstalled(Feature feature);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.Data;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.ShellBuilders;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
@@ -69,13 +70,25 @@ namespace Orchard.Environment.State {
|
||||
var shellContext = _shellContextFactory.CreateDescribedContext(entry.ShellSettings, entry.ShellDescriptor);
|
||||
using (shellContext.LifetimeScope) {
|
||||
using (var standaloneEnvironment = shellContext.LifetimeScope.CreateWorkContextScope()) {
|
||||
var eventBus = standaloneEnvironment.Resolve<IEventBus>();
|
||||
|
||||
Logger.Information("Executing event {0} in process {1} for shell {2}",
|
||||
entry.MessageName,
|
||||
entry.ProcessId,
|
||||
entry.ShellSettings.Name);
|
||||
eventBus.Notify(entry.MessageName, entry.EventData);
|
||||
ITransactionManager transactionManager;
|
||||
if (!standaloneEnvironment.TryResolve(out transactionManager))
|
||||
transactionManager = null;
|
||||
|
||||
try {
|
||||
var eventBus = standaloneEnvironment.Resolve<IEventBus>();
|
||||
Logger.Information("Executing event {0} in process {1} for shell {2}",
|
||||
entry.MessageName,
|
||||
entry.ProcessId,
|
||||
entry.ShellSettings.Name);
|
||||
eventBus.Notify(entry.MessageName, entry.EventData);
|
||||
}
|
||||
catch {
|
||||
// any database changes in this using(env) scope are invalidated
|
||||
if (transactionManager != null)
|
||||
transactionManager.Cancel();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Environment.State.Models;
|
||||
using Orchard.Environment.Descriptor;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.Environment.State {
|
||||
public class ShellStateCoordinator : IShellStateManagerEventHandler, IShellDescriptorManagerEventHandler {
|
||||
@@ -27,8 +28,11 @@ namespace Orchard.Environment.State {
|
||||
_extensionManager = extensionManager;
|
||||
_processingEngine = processingEngine;
|
||||
_featureEvents = featureEvents;
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
void IShellDescriptorManagerEventHandler.Changed(ShellDescriptor descriptor) {
|
||||
// deduce and apply state changes involved
|
||||
var shellState = _stateManager.GetShellState();
|
||||
@@ -73,6 +77,7 @@ namespace Orchard.Environment.State {
|
||||
.ToArray()
|
||||
};
|
||||
|
||||
Logger.Information("Adding pending task 'ApplyChanges' for shell '{0}'", _settings.Name);
|
||||
_processingEngine.AddTask(
|
||||
_settings,
|
||||
descriptor,
|
||||
@@ -98,6 +103,8 @@ namespace Orchard.Environment.State {
|
||||
}
|
||||
|
||||
void IShellStateManagerEventHandler.ApplyChanges() {
|
||||
Logger.Information("Applying changes for for shell '{0}'", _settings.Name);
|
||||
|
||||
var shellState = _stateManager.GetShellState();
|
||||
|
||||
// start with description of all declared features in order - order preserved with all merging
|
||||
@@ -149,25 +156,33 @@ namespace Orchard.Environment.State {
|
||||
|
||||
// lower enabled states in reverse order
|
||||
foreach (var entry in allEntries.Reverse().Where(entry => entry.FeatureState.EnableState == ShellFeatureState.State.Falling)) {
|
||||
_featureEvents.Disable(entry.Feature);
|
||||
Logger.Information("Disabling feature '{0}'", entry.Feature.Descriptor.Id);
|
||||
_featureEvents.Disabling(entry.Feature);
|
||||
_stateManager.UpdateEnabledState(entry.FeatureState, ShellFeatureState.State.Down);
|
||||
_featureEvents.Disabled(entry.Feature);
|
||||
}
|
||||
|
||||
// lower installed states in reverse order
|
||||
foreach (var entry in allEntries.Reverse().Where(entry => entry.FeatureState.InstallState == ShellFeatureState.State.Falling)) {
|
||||
_featureEvents.Uninstall(entry.Feature);
|
||||
Logger.Information("Uninstalling feature '{0}'", entry.Feature.Descriptor.Id);
|
||||
_featureEvents.Uninstalling(entry.Feature);
|
||||
_stateManager.UpdateInstalledState(entry.FeatureState, ShellFeatureState.State.Down);
|
||||
_featureEvents.Uninstalled(entry.Feature);
|
||||
}
|
||||
|
||||
// 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);
|
||||
Logger.Information("Installing feature '{0}'", entry.Feature.Descriptor.Id);
|
||||
_featureEvents.Installing(entry.Feature);
|
||||
_stateManager.UpdateInstalledState(entry.FeatureState, ShellFeatureState.State.Up);
|
||||
_featureEvents.Installed(entry.Feature);
|
||||
}
|
||||
if (entry.FeatureState.EnableState == ShellFeatureState.State.Rising) {
|
||||
_featureEvents.Enable(entry.Feature);
|
||||
Logger.Information("Enabling feature '{0}'", entry.Feature.Descriptor.Id);
|
||||
_featureEvents.Enabling(entry.Feature);
|
||||
_stateManager.UpdateEnabledState(entry.FeatureState, ShellFeatureState.State.Up);
|
||||
_featureEvents.Enabled(entry.Feature);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -22,13 +22,13 @@ namespace Orchard.Events {
|
||||
|
||||
public IEnumerable Notify(string messageName, IDictionary<string, object> eventData) {
|
||||
// call ToArray to ensure evaluation has taken place
|
||||
return NotifyHandlers(messageName, eventData).ToArray();
|
||||
return NotifyHandlers(messageName, eventData, true/*failFast*/).ToArray();
|
||||
}
|
||||
|
||||
private IEnumerable<object> NotifyHandlers(string messageName, IDictionary<string, object> eventData) {
|
||||
private IEnumerable<object> NotifyHandlers(string messageName, IDictionary<string, object> eventData, bool failFast) {
|
||||
string[] parameters = messageName.Split('.');
|
||||
if (parameters.Length != 2) {
|
||||
throw new ArgumentException(messageName + T(" is not formatted correctly"));
|
||||
throw new ArgumentException(T("{0} is not formatted correctly", messageName).Text);
|
||||
}
|
||||
string interfaceName = parameters[0];
|
||||
string methodName = parameters[1];
|
||||
@@ -36,7 +36,7 @@ namespace Orchard.Events {
|
||||
var eventHandlers = _eventHandlers();
|
||||
foreach (var eventHandler in eventHandlers) {
|
||||
IEnumerable returnValue;
|
||||
if (TryNotifyHandler(eventHandler, messageName, interfaceName, methodName, eventData, out returnValue)) {
|
||||
if (TryNotifyHandler(eventHandler, messageName, interfaceName, methodName, eventData, failFast, out returnValue)) {
|
||||
if (returnValue != null) {
|
||||
foreach (var value in returnValue) {
|
||||
yield return value;
|
||||
@@ -46,7 +46,7 @@ namespace Orchard.Events {
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryNotifyHandler(IEventHandler eventHandler, string messageName, string interfaceName, string methodName, IDictionary<string, object> eventData, out IEnumerable returnValue) {
|
||||
private bool TryNotifyHandler(IEventHandler eventHandler, string messageName, string interfaceName, string methodName, IDictionary<string, object> eventData, bool failFast, out IEnumerable returnValue) {
|
||||
try {
|
||||
return TryInvoke(eventHandler, interfaceName, methodName, eventData, out returnValue);
|
||||
}
|
||||
@@ -56,6 +56,9 @@ namespace Orchard.Events {
|
||||
eventHandler.GetType().FullName,
|
||||
ex.GetType().Name);
|
||||
|
||||
if (failFast)
|
||||
throw;
|
||||
|
||||
returnValue = null;
|
||||
return false;
|
||||
}
|
||||
@@ -75,7 +78,7 @@ namespace Orchard.Events {
|
||||
private static bool TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, string methodName, IDictionary<string, object> arguments, out IEnumerable returnValue) {
|
||||
MethodInfo method = GetMatchingMethod(eventHandler, interfaceType, methodName, arguments);
|
||||
if (method != null) {
|
||||
List<object> parameters = new List<object>();
|
||||
var parameters = new List<object>();
|
||||
foreach (var methodParameter in method.GetParameters()) {
|
||||
parameters.Add(arguments[methodParameter.Name]);
|
||||
}
|
||||
@@ -90,8 +93,8 @@ namespace Orchard.Events {
|
||||
}
|
||||
|
||||
private static MethodInfo GetMatchingMethod(IEventHandler eventHandler, Type interfaceType, string methodName, IDictionary<string, object> arguments) {
|
||||
List<MethodInfo> allMethods = new List<MethodInfo>(interfaceType.GetMethods());
|
||||
List<MethodInfo> candidates = new List<MethodInfo>(allMethods);
|
||||
var allMethods = new List<MethodInfo>(interfaceType.GetMethods());
|
||||
var candidates = new List<MethodInfo>(allMethods);
|
||||
|
||||
foreach (var method in allMethods) {
|
||||
if (String.Equals(method.Name, methodName, StringComparison.OrdinalIgnoreCase)) {
|
||||
@@ -114,6 +117,5 @@ namespace Orchard.Events {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
namespace Orchard.Localization {
|
||||
public interface IText : ISingletonDependency {
|
||||
public interface IText {
|
||||
LocalizedString Get(string textHint, params object[] args);
|
||||
}
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Autofac;
|
||||
@@ -8,9 +9,9 @@ using Module = Autofac.Module;
|
||||
namespace Orchard.Localization {
|
||||
public class LocalizationModule : Module {
|
||||
private readonly IDictionary<string, Localizer> _localizerCache;
|
||||
|
||||
|
||||
public LocalizationModule() {
|
||||
_localizerCache = new Dictionary<string, Localizer>();
|
||||
_localizerCache = new ConcurrentDictionary<string, Localizer>();
|
||||
}
|
||||
|
||||
protected override void Load(ContainerBuilder builder) {
|
||||
@@ -28,7 +29,7 @@ namespace Orchard.Localization {
|
||||
if (_localizerCache.ContainsKey(scope)) {
|
||||
userProperty.SetValue(e.Instance, _localizerCache[scope], null);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
var localizer = LocalizationUtilities.Resolve(e.Context, scope);
|
||||
_localizerCache.Add(scope, localizer);
|
||||
userProperty.SetValue(e.Instance, localizer, null);
|
||||
|
Reference in New Issue
Block a user