From f3971484b853f0b9e733af21f100a07de881aab0 Mon Sep 17 00:00:00 2001 From: Thierry Fleury Date: Sat, 23 Jan 2016 10:32:22 +0100 Subject: [PATCH 01/25] Fixes #5593 : Dynamic Forms: In form settings HtmlEncode option is always checked --- .../Modules/Orchard.DynamicForms/Drivers/FormElementDriver.cs | 1 - src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/Form.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/FormElementDriver.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/FormElementDriver.cs index 7c6a0be09..515b71633 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/FormElementDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/FormElementDriver.cs @@ -83,7 +83,6 @@ namespace Orchard.DynamicForms.Drivers { Name: "HtmlEncode", Title: "Html Encode", Value: "true", - Checked: true, Description: T("Check this option to automatically HTML encode submitted values to prevent code injection.")), _CreateContent: shape.Checkbox( Id: "CreateContent", diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/Form.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/Form.cs index 2c6c44996..cd9c211db 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/Form.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Elements/Form.cs @@ -33,7 +33,7 @@ namespace Orchard.DynamicForms.Elements { } public bool HtmlEncode { - get { return this.Retrieve(x => x.HtmlEncode, () => true); } + get { return this.Retrieve(x => x.HtmlEncode); } set { this.Store(x => x.HtmlEncode, value); } } From 4cc48a380d4aab71c750ffbe950bf8ab85dcc0c6 Mon Sep 17 00:00:00 2001 From: Lombiq Date: Wed, 17 Feb 2016 21:05:14 +0100 Subject: [PATCH 02/25] You can't create two Template content items with the same name (title) any more, fixes #6360 --- .../Drivers/TitlePartDriver.cs | 46 +++++++++++++++++++ .../Orchard.Templates.csproj | 1 + 2 files changed, 47 insertions(+) create mode 100644 src/Orchard.Web/Modules/Orchard.Templates/Drivers/TitlePartDriver.cs diff --git a/src/Orchard.Web/Modules/Orchard.Templates/Drivers/TitlePartDriver.cs b/src/Orchard.Web/Modules/Orchard.Templates/Drivers/TitlePartDriver.cs new file mode 100644 index 000000000..7ee00ab15 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Templates/Drivers/TitlePartDriver.cs @@ -0,0 +1,46 @@ +using Orchard.ContentManagement; +using Orchard.ContentManagement.Drivers; +using Orchard.Core.Title.Models; +using Orchard.Localization; +using Orchard.Templates.Models; +using System.Linq; + +namespace Orchard.Templates.Drivers { + public class TitlePartDriver : ContentPartDriver { + private readonly IContentManager _contentManager; + + public Localizer T { get; set; } + + public TitlePartDriver(IContentManager contentManager) { + _contentManager = contentManager; + + T = NullLocalizer.Instance; + } + + protected override DriverResult Editor(TitlePart part, IUpdateModel updater, dynamic shapeHelper) { + if (!part.ContentItem.Has()) { + return null; + } + + updater.TryUpdateModel(part, Prefix, null, null); + + // We need to query for the content type names because querying for content parts has no effect on the database side. + var contentTypesWithShapePart = _contentManager + .GetContentTypeDefinitions() + .Where(typeDefinition => typeDefinition.Parts.Any(partDefinition => partDefinition.PartDefinition.Name == "ShapePart")) + .Select(typeDefinition => typeDefinition.Name) + .ToArray(); + + var existingShapeCount = _contentManager + .Query(VersionOptions.Latest, contentTypesWithShapePart) + .Where(record => record.Title == part.Title && record.ContentItemRecord.Id != part.ContentItem.Id) + .Count(); + + if (existingShapeCount > 0) { + updater.AddModelError("ShapeNameAlreadyExists", T("A template with the given name already exists.")); + } + + return null; + } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Templates/Orchard.Templates.csproj b/src/Orchard.Web/Modules/Orchard.Templates/Orchard.Templates.csproj index 6dd9096c1..0464a2214 100644 --- a/src/Orchard.Web/Modules/Orchard.Templates/Orchard.Templates.csproj +++ b/src/Orchard.Web/Modules/Orchard.Templates/Orchard.Templates.csproj @@ -162,6 +162,7 @@ + From 49022cd1b5f486c4dc0cbab8543e99fa0485d6e3 Mon Sep 17 00:00:00 2001 From: Lombiq Date: Thu, 18 Feb 2016 16:32:16 +0100 Subject: [PATCH 03/25] To the previous: also caring about the case when ShapePart was dynamically added to the content type/item, see #6360 --- .../Modules/Orchard.Templates/Drivers/TitlePartDriver.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Templates/Drivers/TitlePartDriver.cs b/src/Orchard.Web/Modules/Orchard.Templates/Drivers/TitlePartDriver.cs index 7ee00ab15..2a7b6c37c 100644 --- a/src/Orchard.Web/Modules/Orchard.Templates/Drivers/TitlePartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Templates/Drivers/TitlePartDriver.cs @@ -28,11 +28,14 @@ namespace Orchard.Templates.Drivers { var contentTypesWithShapePart = _contentManager .GetContentTypeDefinitions() .Where(typeDefinition => typeDefinition.Parts.Any(partDefinition => partDefinition.PartDefinition.Name == "ShapePart")) - .Select(typeDefinition => typeDefinition.Name) - .ToArray(); + .Select(typeDefinition => typeDefinition.Name); + + // If ShapePart is only dynamically added to this content type or even this content item then we won't find + // a corresponding content type definition, so using the current content type too. + contentTypesWithShapePart = contentTypesWithShapePart.Union(new[] { part.ContentItem.ContentType }); var existingShapeCount = _contentManager - .Query(VersionOptions.Latest, contentTypesWithShapePart) + .Query(VersionOptions.Latest, contentTypesWithShapePart.ToArray()) .Where(record => record.Title == part.Title && record.ContentItemRecord.Id != part.ContentItem.Id) .Count(); From 2a01771a375b0701714859e07135384d085b9a19 Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Thu, 18 Feb 2016 21:44:57 +0000 Subject: [PATCH 04/25] fixes #6272 update wording for comparisons --- .../FilterEditors/Forms/DateTimeFilterForm.cs | 4 ++-- .../FilterEditors/Forms/NumericFilterForm.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Projections/FilterEditors/Forms/DateTimeFilterForm.cs b/src/Orchard.Web/Modules/Orchard.Projections/FilterEditors/Forms/DateTimeFilterForm.cs index 28dbe68e9..cbca13934 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/FilterEditors/Forms/DateTimeFilterForm.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/FilterEditors/Forms/DateTimeFilterForm.cs @@ -251,7 +251,7 @@ namespace Orchard.Projections.FilterEditors.Forms { case DateTimeOperator.LessThan: return T("{0} is less than {1}{2}", fieldName, value, T(valueUnit)); case DateTimeOperator.LessThanEquals: - return T("{0} is less or equal than {1}{2}", fieldName, value, T(valueUnit)); + return T("{0} is less than or equal to {1}{2}", fieldName, value, T(valueUnit)); case DateTimeOperator.Equals: return T("{0} equals {1}{2}", fieldName, value, T(valueUnit)); case DateTimeOperator.NotEquals: @@ -259,7 +259,7 @@ namespace Orchard.Projections.FilterEditors.Forms { case DateTimeOperator.GreaterThan: return T("{0} is greater than {1}{2}", fieldName, value, T(valueUnit)); case DateTimeOperator.GreaterThanEquals: - return T("{0} is greater or equal than {1}{2}", fieldName, value, T(valueUnit)); + return T("{0} is greater than or equal to {1}{2}", fieldName, value, T(valueUnit)); case DateTimeOperator.Between: return T("{0} is between {1}{2} and {3}{4}", fieldName, min, T(minUnit), max, T(maxUnit)); case DateTimeOperator.NotBetween: diff --git a/src/Orchard.Web/Modules/Orchard.Projections/FilterEditors/Forms/NumericFilterForm.cs b/src/Orchard.Web/Modules/Orchard.Projections/FilterEditors/Forms/NumericFilterForm.cs index eb37f44d9..f0ead2a0d 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/FilterEditors/Forms/NumericFilterForm.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/FilterEditors/Forms/NumericFilterForm.cs @@ -128,7 +128,7 @@ namespace Orchard.Projections.FilterEditors.Forms { case NumericOperator.LessThan: return T("{0} is less than {1}", fieldName, value); case NumericOperator.LessThanEquals: - return T("{0} is less or equal than {1}", fieldName, value); + return T("{0} is less than or equal to {1}", fieldName, value); case NumericOperator.Equals: return T("{0} equals {1}", fieldName, value); case NumericOperator.NotEquals: @@ -136,7 +136,7 @@ namespace Orchard.Projections.FilterEditors.Forms { case NumericOperator.GreaterThan: return T("{0} is greater than {1}", fieldName, value); case NumericOperator.GreaterThanEquals: - return T("{0} is greater or equal than {1}", fieldName, value); + return T("{0} is greater than or equal to {1}", fieldName, value); case NumericOperator.Between: return T("{0} is between {1} and {2}", fieldName, min, max); case NumericOperator.NotBetween: From 5811598dffaaa16e3c059a4d933800cc06417ae2 Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Thu, 18 Feb 2016 22:01:52 +0000 Subject: [PATCH 05/25] fixes 6400 - improve notifier messages for terms admin --- .../Controllers/TermAdminController.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs index 8ca973f80..9908b9a34 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs @@ -10,6 +10,7 @@ using Orchard.UI.Admin; using Orchard.ContentManagement; using Orchard.UI.Notify; using Orchard.Taxonomies.Helpers; +using Orchard.Mvc.Html; namespace Orchard.Taxonomies.Controllers { [ValidateInput(false), Admin] @@ -44,15 +45,24 @@ namespace Orchard.Taxonomies.Controllers { var checkedEntries = viewModel.Terms.Where(t => t.IsChecked).ToList(); switch (viewModel.BulkAction) { case TermsAdminIndexBulkAction.None: + Services.Notifier.Information(T("No action selected.")); break; case TermsAdminIndexBulkAction.Delete: if (!Services.Authorizer.Authorize(Permissions.ManageTerms, T("Couldn't delete term"))) return new HttpUnauthorizedResult(); + + if(!checkedEntries.Any()) { + Services.Notifier.Information(T("No terms selected.")); + break; + } foreach (var entry in checkedEntries) { var term = _taxonomyService.GetTerm(entry.Id); _taxonomyService.DeleteTerm(term); } + + Services.Notifier.Information(T.Plural("{0} term has been removed.", "{0} terms have been removed.", checkedEntries.Count)); + break; case TermsAdminIndexBulkAction.Merge: if (!Services.Authorizer.Authorize(Permissions.ManageTerms, T("Couldn't delete term"))) @@ -74,8 +84,6 @@ namespace Orchard.Taxonomies.Controllers { throw new ArgumentOutOfRangeException(); } - Services.Notifier.Information(T("{0} term have been removed.", checkedEntries.Count)); - return RedirectToAction("Index", new { taxonomyId = viewModel.TaxonomyId }); } From fe5c8ba2332bce6036482ab1fb589384bfcbcbc8 Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Fri, 19 Feb 2016 00:27:53 +0000 Subject: [PATCH 06/25] fixes #6423 - wrong permission checked for delete --- .../Modules/Orchard.Taxonomies/Controllers/AdminController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/AdminController.cs index 12b1cbf03..50fbf36bc 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/AdminController.cs @@ -68,7 +68,7 @@ namespace Orchard.Taxonomies.Controllers { [HttpPost] public ActionResult Delete(int id) { - if (!Services.Authorizer.Authorize(Permissions.CreateTaxonomy, T("Couldn't delete taxonomy"))) + if (!Services.Authorizer.Authorize(Permissions.ManageTaxonomies, T("Couldn't delete taxonomy"))) return new HttpUnauthorizedResult(); var taxonomy = _taxonomyService.GetTaxonomy(id); From c61666bfdc70bf4f865e96d72bcd8ea70ad4ac07 Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Fri, 19 Feb 2016 00:32:40 +0000 Subject: [PATCH 07/25] fix typo in Orchard.Widgets.RuleEngine.cs --- .../Modules/Orchard.Widgets/RuleEngine/RuleManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/RuleEngine/RuleManager.cs b/src/Orchard.Web/Modules/Orchard.Widgets/RuleEngine/RuleManager.cs index 3b2457df1..11c22b987 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/RuleEngine/RuleManager.cs +++ b/src/Orchard.Web/Modules/Orchard.Widgets/RuleEngine/RuleManager.cs @@ -21,7 +21,7 @@ namespace Orchard.Widgets.RuleEngine { public bool Matches(string expression) { var evaluator = _evaluators.FirstOrDefault(); if (evaluator == null) { - throw new OrchardException(T("There are currently not scripting engine enabled")); + throw new OrchardException(T("There are currently no scripting engine's enabled")); } var result = evaluator.Evaluate(expression, new List { new GlobalMethodProvider(this) }); From 89a5953ea3dfde462c8537a028af64a73200c325 Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Fri, 19 Feb 2016 00:45:54 +0000 Subject: [PATCH 08/25] fix wrong permission check and incorrect use of taxonomies phrase --- .../Orchard.Taxonomies/Controllers/TermAdminController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs b/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs index 9908b9a34..8097c83c4 100644 --- a/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/TermAdminController.cs @@ -189,7 +189,7 @@ namespace Orchard.Taxonomies.Controllers { public ActionResult Edit(int id) { - if (!Services.Authorizer.Authorize(Permissions.ManageTerms, T("Not allowed to manage taxonomies"))) + if (!Services.Authorizer.Authorize(Permissions.ManageTerms, T("Not allowed to manage terms"))) return new HttpUnauthorizedResult(); var term = _taxonomyService.GetTerm(id); @@ -202,7 +202,7 @@ namespace Orchard.Taxonomies.Controllers { [HttpPost, ActionName("Edit")] public ActionResult EditPost(int id) { - if (!Services.Authorizer.Authorize(Permissions.ManageTaxonomies, T("Couldn't edit taxonomy"))) + if (!Services.Authorizer.Authorize(Permissions.ManageTerms, T("Couldn't edit term"))) return new HttpUnauthorizedResult(); var term = _taxonomyService.GetTerm(id); From 5dfda7c0a8c8708ed7ff78eb70ac163ebb1af3bc Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Fri, 19 Feb 2016 01:36:28 +0000 Subject: [PATCH 09/25] convert modules admin page to use css flexbox --- .../styles/orchard-modules-admin.css | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Modules/styles/orchard-modules-admin.css b/src/Orchard.Web/Modules/Orchard.Modules/styles/orchard-modules-admin.css index 61496e5a9..4626a86b4 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/styles/orchard-modules-admin.css +++ b/src/Orchard.Web/Modules/Orchard.Modules/styles/orchard-modules-admin.css @@ -6,18 +6,21 @@ html.dyn #main ul.features button { display:none; } .features.detail-view .category > ul { border:1px solid #EAEAEA; margin-bottom:2em; + display: flex; + flex-direction: column; } .features.summary-view .category { - overflow:hidden; padding-bottom:1em; } + +.features.summary-view .category > ul { + display: flex; + flex-wrap: wrap; +} + .features.summary-view .feature { border:1px solid #EAEAEA; - display:block; - float:left; - height:6em; margin:0 .5% 1% .5%; - position:relative; width:32%; } From bbe4110053c5d1cca096d1d186f2513e499c498c Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Fri, 19 Feb 2016 01:43:55 +0000 Subject: [PATCH 10/25] fix typo in typo fix --- .../Modules/Orchard.Widgets/RuleEngine/RuleManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/RuleEngine/RuleManager.cs b/src/Orchard.Web/Modules/Orchard.Widgets/RuleEngine/RuleManager.cs index 11c22b987..17f8a2c48 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/RuleEngine/RuleManager.cs +++ b/src/Orchard.Web/Modules/Orchard.Widgets/RuleEngine/RuleManager.cs @@ -21,7 +21,7 @@ namespace Orchard.Widgets.RuleEngine { public bool Matches(string expression) { var evaluator = _evaluators.FirstOrDefault(); if (evaluator == null) { - throw new OrchardException(T("There are currently no scripting engine's enabled")); + throw new OrchardException(T("There are currently no scripting engines enabled")); } var result = evaluator.Evaluate(expression, new List { new GlobalMethodProvider(this) }); From a806ac74875778016c397b11ff6b07755a1b77d3 Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Fri, 19 Feb 2016 01:56:33 +0000 Subject: [PATCH 11/25] fix display glitch in admin packaging/gallery/modules --- .../Orchard.Packaging/Styles/orchard-packaging-admin.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Styles/orchard-packaging-admin.css b/src/Orchard.Web/Modules/Orchard.Packaging/Styles/orchard-packaging-admin.css index 8e7e369b7..e8c93ea06 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Styles/orchard-packaging-admin.css +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Styles/orchard-packaging-admin.css @@ -11,7 +11,7 @@ float:left; } .extensionName.installed { - background: url("images/installed.gif") no-repeat 0px 8px #fff; + background: url("images/installed.gif") no-repeat 0px 8px; padding:0 0 0 60px; } .contentItems .related { From 1907e5790267134c079a7e291290dc2007e9e092 Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Fri, 19 Feb 2016 02:27:23 +0000 Subject: [PATCH 12/25] fixes #5706 - standardize order on Properties, Validation, Bindings --- .../Orchard.DynamicForms/Drivers/BindingsElementDriver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/BindingsElementDriver.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/BindingsElementDriver.cs index f30894420..fa7c2ee13 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/BindingsElementDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/BindingsElementDriver.cs @@ -37,7 +37,7 @@ namespace Orchard.DynamicForms.Drivers { var bindingsEditor = context.ShapeFactory.EditorTemplate(TemplateName: "FormBindings", Model: viewModel); - bindingsEditor.Metadata.Position = "Bindings:10"; + bindingsEditor.Metadata.Position = "Bindings:20"; return Editor(context, bindingsEditor); } From a8d4b18f72e834965b3f707c513aa000b40d64a1 Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Fri, 19 Feb 2016 22:44:52 +0000 Subject: [PATCH 13/25] fixes #5708 - change ui layer to display Mandatory checkbox as required --- .../Orchard.DynamicForms/Drivers/CheckboxElementDriver.cs | 4 ++-- .../Modules/Orchard.DynamicForms/ValidationRules/Mandatory.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/CheckboxElementDriver.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/CheckboxElementDriver.cs index 5557fdd3e..7f9b7a9cc 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/CheckboxElementDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/CheckboxElementDriver.cs @@ -45,9 +45,9 @@ namespace Orchard.DynamicForms.Drivers { _IsRequired: shape.Checkbox( Id: "IsMandatory", Name: "IsMandatory", - Title: "Mandatory", + Title: "Required", Value: "true", - Description: T("Tick this checkbox to make this check box element mandatory.")), + Description: T("Tick this checkbox to make this check box element required.")), _CustomValidationMessage: shape.Textbox( Id: "CustomValidationMessage", Name: "CustomValidationMessage", diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/ValidationRules/Mandatory.cs b/src/Orchard.Web/Modules/Orchard.DynamicForms/ValidationRules/Mandatory.cs index 0a90fa735..48237982d 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/ValidationRules/Mandatory.cs +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/ValidationRules/Mandatory.cs @@ -18,7 +18,7 @@ namespace Orchard.DynamicForms.ValidationRules { private LocalizedString GetValidationMessage(ValidationContext context) { return String.IsNullOrWhiteSpace(ErrorMessage) - ? T("{0} is a mandatory field.", context.FieldName) + ? T("{0} is a required field.", context.FieldName) : T(ErrorMessage); } } From 026acc4aa917850e228c935910dbd12c81734a35 Mon Sep 17 00:00:00 2001 From: andy zheng Date: Sun, 28 Feb 2016 13:30:11 -0500 Subject: [PATCH 14/25] fixed one of URL prefix and Host should be required --- .../Orchard.MultiTenancy/Controllers/AdminController.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Orchard.Web/Modules/Orchard.MultiTenancy/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.MultiTenancy/Controllers/AdminController.cs index 489838e99..458d1ffbb 100644 --- a/src/Orchard.Web/Modules/Orchard.MultiTenancy/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.MultiTenancy/Controllers/AdminController.cs @@ -68,6 +68,10 @@ namespace Orchard.MultiTenancy.Controllers { ModelState.AddModelError("Name", T("Invalid tenant name. Must contain characters only and no spaces.").Text); } + if (!string.Equals(viewModel.Name, "default", StringComparison.OrdinalIgnoreCase) && string.IsNullOrWhiteSpace( viewModel.RequestUrlHost) && string.IsNullOrWhiteSpace(viewModel.RequestUrlPrefix)) { + ModelState.AddModelError("RequestUrlHostRequestUrlPrefix", T("RequestUrlHost and RequestUrlPrefix can not be empty at the same time.").Text); + } + if (!ModelState.IsValid) { return View(viewModel); } @@ -139,6 +143,10 @@ namespace Orchard.MultiTenancy.Controllers { if (tenant == null) return HttpNotFound(); + if (!string.Equals(viewModel.Name, "default", StringComparison.OrdinalIgnoreCase) && string.IsNullOrWhiteSpace(viewModel.RequestUrlHost) && string.IsNullOrWhiteSpace(viewModel.RequestUrlPrefix)) { + ModelState.AddModelError("RequestUrlHostRequestUrlPrefix", T("RequestUrlHost and RequestUrlPrefix can not be empty at the same time.").Text); + } + if (!ModelState.IsValid) { return View(viewModel); } From aae9f6270e41dabbfe9122f4340d22590d274966 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Wed, 9 Mar 2016 15:37:44 -0800 Subject: [PATCH 15/25] [Fixes #6526] Unwrap TargetInvocationException when executing a ShapeAttributeBinding --- .../ShapeAttributeBindingStrategy.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Orchard/DisplayManagement/Descriptors/ShapeAttributeStrategy/ShapeAttributeBindingStrategy.cs b/src/Orchard/DisplayManagement/Descriptors/ShapeAttributeStrategy/ShapeAttributeBindingStrategy.cs index 22ad79ca7..3dbe111e8 100644 --- a/src/Orchard/DisplayManagement/Descriptors/ShapeAttributeStrategy/ShapeAttributeBindingStrategy.cs +++ b/src/Orchard/DisplayManagement/Descriptors/ShapeAttributeStrategy/ShapeAttributeBindingStrategy.cs @@ -60,12 +60,18 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy { var output = new HtmlStringWriter(); var arguments = methodInfo.GetParameters() .Select(parameter => BindParameter(displayContext, parameter, output)); - - var returnValue = methodInfo.Invoke(serviceInstance, arguments.ToArray()); - if (methodInfo.ReturnType != typeof(void)) { - output.Write(CoerceHtmlString(returnValue)); + try { + var returnValue = methodInfo.Invoke(serviceInstance, arguments.ToArray()); + if (methodInfo.ReturnType != typeof(void)) { + output.Write(CoerceHtmlString(returnValue)); + } + return output; + } + catch(TargetInvocationException e) { + // Throwing a TIE here will probably kill the web process + // in Azure. For unknown reasons. + throw e.InnerException; } - return output; } private static IHtmlString CoerceHtmlString(object invoke) { From 712ff2f4871f795720fb8fd180d794446264ab1c Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Tue, 23 Feb 2016 16:36:02 -0800 Subject: [PATCH 16/25] Retrying on tenant startup Conflicts: src/Orchard.Web/Config/HostComponents.config src/Orchard/Environment/DefaultOrchardHost.cs --- src/Orchard.Web/Config/HostComponents.config | 9 +++++ src/Orchard/Environment/DefaultOrchardHost.cs | 39 ++++++++++++++----- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/Orchard.Web/Config/HostComponents.config b/src/Orchard.Web/Config/HostComponents.config index 01038d9c4..b05392935 100644 --- a/src/Orchard.Web/Config/HostComponents.config +++ b/src/Orchard.Web/Config/HostComponents.config @@ -106,5 +106,14 @@ + + + + + + + + + diff --git a/src/Orchard/Environment/DefaultOrchardHost.cs b/src/Orchard/Environment/DefaultOrchardHost.cs index 75db6b716..d69a380f9 100644 --- a/src/Orchard/Environment/DefaultOrchardHost.cs +++ b/src/Orchard/Environment/DefaultOrchardHost.cs @@ -14,6 +14,7 @@ using Orchard.Localization; using Orchard.Logging; using Orchard.Utility.Extensions; using Orchard.Exceptions; +using System.Threading; namespace Orchard.Environment { // All the event handlers that DefaultOrchardHost implements have to be declared in OrchardStarter @@ -32,6 +33,10 @@ namespace Orchard.Environment { private IEnumerable _shellContexts; private readonly ContextState> _tenantsToRestart; + public int Retries { get; set; } + + public bool DelayRetries { get; set; } + public DefaultOrchardHost( IShellSettingsManager shellSettingsManager, IShellContextFactory shellContextFactory, @@ -137,16 +142,32 @@ namespace Orchard.Environment { // load all tenants, and activate their shell if (allSettings.Any()) { Parallel.ForEach(allSettings, settings => { - try { - var context = CreateShellContext(settings); - ActivateShell(context); - } - catch (Exception ex) { - if (ex.IsFatal()) { - throw; - } - Logger.Error(ex, "A tenant could not be started: " + settings.Name); + for (var i = 0; i <= Retries; i++) { + + // Not the first attempt, wait for a while ... + if (DelayRetries && i > 0) { + // Waits for i^2 which means 1, 2, 4, 8 ... seconds + Thread.Sleep(TimeSpan.FromSeconds(Math.Pow(i, 2))); + } + + bool failed = false; + try { + var context = CreateShellContext(settings); + ActivateShell(context); + } + catch (Exception ex) { + // An exception at this point is always fatal as it literally kills the + // tenant. What is more fatal than something that kills you? + Logger.Error(ex, "A tenant could not be started: " + settings.Name + " Attempt number: " + i); + failed = true; + } + + if(failed && i == Retries) { + Logger.Fatal("A tenant could not be started: {0} after {1} retries.", settings.Name, Retries); + return; + } } + while (_processingEngine.AreTasksPending()) { Logger.Debug("Processing pending task after activate Shell"); _processingEngine.ExecuteNextTask(); From 31ed21b06175b91a14f65677f8ad976e1894ce10 Mon Sep 17 00:00:00 2001 From: Carl Woodhouse Date: Thu, 10 Mar 2016 20:31:55 +0000 Subject: [PATCH 17/25] Output cache route config fixes #6523 --- .../Filters/OutputCacheFilter.cs | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs index 56be73b56..20dd7976a 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs @@ -71,6 +71,7 @@ namespace Orchard.OutputCache.Filters { // State. private CacheSettings _cacheSettings; + private CacheRouteConfig _cacheRouteConfig; private DateTime _now; private WorkContext _workContext; private string _cacheKey; @@ -92,6 +93,13 @@ namespace Orchard.OutputCache.Filters { _now = _clock.UtcNow; _workContext = _workContextAccessor.GetContext(); + var configurations = _cacheService.GetRouteConfigs(); + if (configurations.Any()) { + var route = filterContext.Controller.ControllerContext.RouteData.Route; + var key = _cacheService.GetRouteDescriptorKey(filterContext.HttpContext, route); + _cacheRouteConfig = configurations.FirstOrDefault(c => c.RouteKey == key); + } + if (!RequestIsCacheable(filterContext)) return; @@ -180,16 +188,8 @@ namespace Orchard.OutputCache.Filters { Logger.Debug("Item '{0}' was rendered.", _cacheKey); - // Obtain individual route configuration, if any. - CacheRouteConfig configuration = null; - var configurations = _cacheService.GetRouteConfigs(); - if (configurations.Any()) { - var route = filterContext.Controller.ControllerContext.RouteData.Route; - var key = _cacheService.GetRouteDescriptorKey(filterContext.HttpContext, route); - configuration = configurations.FirstOrDefault(c => c.RouteKey == key); - } - - if (!ResponseIsCacheable(filterContext, configuration)) { + + if (!ResponseIsCacheable(filterContext)) { filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache); filterContext.HttpContext.Response.Cache.SetNoStore(); filterContext.HttpContext.Response.Cache.SetMaxAge(new TimeSpan(0)); @@ -197,8 +197,8 @@ namespace Orchard.OutputCache.Filters { } // Determine duration and grace time. - var cacheDuration = configuration != null && configuration.Duration.HasValue ? configuration.Duration.Value : CacheSettings.DefaultCacheDuration; - var cacheGraceTime = configuration != null && configuration.GraceTime.HasValue ? configuration.GraceTime.Value : CacheSettings.DefaultCacheGraceTime; + var cacheDuration = _cacheRouteConfig != null && _cacheRouteConfig.Duration.HasValue ? _cacheRouteConfig.Duration.Value : CacheSettings.DefaultCacheDuration; + var cacheGraceTime = _cacheRouteConfig != null && _cacheRouteConfig.GraceTime.HasValue ? _cacheRouteConfig.GraceTime.Value : CacheSettings.DefaultCacheGraceTime; // Include each content item ID as tags for the cache entry. var contentItemIds = _displayedContentItemHandler.GetDisplayed().Select(x => x.ToString(CultureInfo.InvariantCulture)).ToArray(); @@ -312,6 +312,12 @@ namespace Orchard.OutputCache.Filters { return false; } + // Don't cache if individual route configuration says no. + if (_cacheRouteConfig != null && _cacheRouteConfig.Duration == 0) { + Logger.Debug("Request for item '{0}' ignored because route is configured to not be cached.", itemDescriptor); + return false; + } + // Ignore requests with the refresh key on the query string. foreach (var key in filterContext.RequestContext.HttpContext.Request.QueryString.AllKeys) { if (String.Equals(_refreshKey, key, StringComparison.OrdinalIgnoreCase)) { @@ -323,7 +329,7 @@ namespace Orchard.OutputCache.Filters { return true; } - protected virtual bool ResponseIsCacheable(ResultExecutedContext filterContext, CacheRouteConfig configuration) { + protected virtual bool ResponseIsCacheable(ResultExecutedContext filterContext) { if (filterContext.HttpContext.Request.Url == null) { return false; @@ -335,12 +341,6 @@ namespace Orchard.OutputCache.Filters { return false; } - // Don't cache in individual route configuration says no. - if (configuration != null && configuration.Duration == 0) { - Logger.Debug("Response for item '{0}' will not be cached because route is configured to not be cached.", _cacheKey); - return false; - } - // Don't cache if request created notifications. var hasNotifications = !String.IsNullOrEmpty(Convert.ToString(filterContext.Controller.TempData["messages"])); if (hasNotifications) { @@ -626,4 +626,4 @@ namespace Orchard.OutputCache.Filters { public class ViewDataContainer : IViewDataContainer { public ViewDataDictionary ViewData { get; set; } } -} \ No newline at end of file +} From 30f163bd39ab6c90bcb29fd28e79fe2c80ef3043 Mon Sep 17 00:00:00 2001 From: jtkech Date: Thu, 10 Mar 2016 22:46:19 +0100 Subject: [PATCH 18/25] Update MultiTenancy.feature.cs --- src/Orchard.Specs/MultiTenancy.feature.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Orchard.Specs/MultiTenancy.feature.cs b/src/Orchard.Specs/MultiTenancy.feature.cs index 44a76620a..61b060490 100644 --- a/src/Orchard.Specs/MultiTenancy.feature.cs +++ b/src/Orchard.Specs/MultiTenancy.feature.cs @@ -129,6 +129,9 @@ this.ScenarioSetup(scenarioInfo); table1.AddRow(new string[] { "Name", "Scott"}); + table1.AddRow(new string[] { + "RequestUrlPrefix", + "scott"}); #line 25 testRunner.And("I fill in", ((string)(null)), table1, "And "); #line 28 @@ -163,6 +166,9 @@ this.ScenarioSetup(scenarioInfo); table2.AddRow(new string[] { "Name", "Scott"}); + table2.AddRow(new string[] { + "RequestUrlPrefix", + "scott"}); #line 37 testRunner.And("I fill in", ((string)(null)), table2, "And "); #line 40 From 447728df03c615655409cc16e5b9620dee58e55e Mon Sep 17 00:00:00 2001 From: jtkech Date: Thu, 10 Mar 2016 22:47:51 +0100 Subject: [PATCH 19/25] Update MultiTenancy.feature --- src/Orchard.Specs/MultiTenancy.feature | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Specs/MultiTenancy.feature b/src/Orchard.Specs/MultiTenancy.feature index 59caddb6b..8b72faf1f 100644 --- a/src/Orchard.Specs/MultiTenancy.feature +++ b/src/Orchard.Specs/MultiTenancy.feature @@ -25,6 +25,7 @@ Scenario: A new tenant is created And I fill in | name | value | | Name | Scott | + | RequestUrlPrefix | scott | And I hit "Save" And I am redirected Then I should see "

Scott\s*

" @@ -37,6 +38,7 @@ Scenario: A new tenant is created with uninitialized state And I fill in | name | value | | Name | Scott | + | RequestUrlPrefix | scott | And I hit "Save" And I am redirected Then I should see "
  • " @@ -199,4 +201,4 @@ Scenario: Listing tenants from command line And I have tenant "Alpha" on "example.org" as "New-site-name" When I execute >tenant list Then I should see "Name: Alpha" - And I should see "Request Url Host: example.org" \ No newline at end of file + And I should see "Request Url Host: example.org" From 3b7a54f10d11c2269e9d187e4e5db3e21c84b408 Mon Sep 17 00:00:00 2001 From: jtkech Date: Thu, 10 Mar 2016 23:26:25 +0100 Subject: [PATCH 20/25] Update Shapes.cs --- src/Orchard.Web/Modules/Orchard.Lists/Shapes.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Lists/Shapes.cs b/src/Orchard.Web/Modules/Orchard.Lists/Shapes.cs index 0f0edeece..405dc40a3 100644 --- a/src/Orchard.Web/Modules/Orchard.Lists/Shapes.cs +++ b/src/Orchard.Web/Modules/Orchard.Lists/Shapes.cs @@ -24,6 +24,8 @@ namespace Orchard.Lists { builder.Describe("ListNavigation").OnDisplaying(context => { var containable = (ContainablePart) context.Shape.ContainablePart; var container = _containerService.Value.GetContainer(containable, VersionOptions.Latest); + if (container == null) return; + var previous = _containerService.Value.Previous(container.Id, containable); var next = _containerService.Value.Next(container.Id, containable); @@ -32,4 +34,4 @@ namespace Orchard.Lists { }); } } -} \ No newline at end of file +} From af7da7963e9b8cb8671bcbfa37a06a22a7578973 Mon Sep 17 00:00:00 2001 From: jtkech Date: Thu, 10 Mar 2016 23:28:08 +0100 Subject: [PATCH 21/25] Update List.cshtml --- src/Orchard.Web/Modules/Orchard.Lists/Views/Admin/List.cshtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Lists/Views/Admin/List.cshtml b/src/Orchard.Web/Modules/Orchard.Lists/Views/Admin/List.cshtml index af414e8fd..7b32b3643 100644 --- a/src/Orchard.Web/Modules/Orchard.Lists/Views/Admin/List.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Lists/Views/Admin/List.cshtml @@ -3,7 +3,7 @@ @using Orchard.ContentManagement; @{ Style.Require("jQueryColorBox"); - Style.Include("nprogress.css", "nprogress.min.css"); + Style.Include("nprogress.css"); Style.Include("common-admin.css", "common-admin.min.css"); Style.Include("list-admin.css", "list-admin.min.css"); Script.Require("ContentPicker").AtFoot(); @@ -39,4 +39,4 @@ @if (Model.ListNavigation != null) { @Display(Model.ListNavigation) -} \ No newline at end of file +} From 181db1835582f86eb846d8117ca8342671891bcd Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 10 Mar 2016 14:52:08 -0800 Subject: [PATCH 22/25] Adding correct ETag support --- .../Filters/OutputCacheFilter.cs | 42 +++++++++++++------ .../Orchard.OutputCache/Models/CacheItem.cs | 3 +- .../Services/DefaultCacheStorageProvider.cs | 1 + 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs index 56be73b56..2f312dd01 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs @@ -207,6 +207,15 @@ namespace Orchard.OutputCache.Filters { var response = filterContext.HttpContext.Response; var captureStream = new CaptureStream(response.Filter); response.Filter = captureStream; + + // Add ETag header for the newly created item + var etag = Guid.NewGuid().ToString("n"); + if (HttpRuntime.UsingIntegratedPipeline) { + if (response.Headers.Get("ETag") == null) { + response.Headers["ETag"] = etag; + } + } + captureStream.Captured += (output) => { try { // Since this is a callback any call to injected dependencies can result in an Autofac exception: "Instances @@ -227,12 +236,12 @@ namespace Orchard.OutputCache.Filters { Url = filterContext.HttpContext.Request.Url.AbsolutePath, Tenant = scope.Resolve().Name, StatusCode = response.StatusCode, - Tags = new[] { _invariantCacheKey }.Union(contentItemIds).ToArray() + Tags = new[] { _invariantCacheKey }.Union(contentItemIds).ToArray(), + ETag = etag }; // Write the rendered item to the cache. var cacheStorageProvider = scope.Resolve(); - cacheStorageProvider.Remove(_cacheKey); cacheStorageProvider.Set(_cacheKey, cacheItem); Logger.Debug("Item '{0}' was written to cache.", _cacheKey); @@ -465,6 +474,7 @@ namespace Orchard.OutputCache.Filters { private void ServeCachedItem(ActionExecutingContext filterContext, CacheItem cacheItem) { var response = filterContext.HttpContext.Response; + var request = filterContext.HttpContext.Request; // Fix for missing charset in response headers response.Charset = response.Charset; @@ -474,12 +484,27 @@ namespace Orchard.OutputCache.Filters { response.AddHeader("X-Cached-On", cacheItem.CachedOnUtc.ToString("r")); response.AddHeader("X-Cached-Until", cacheItem.ValidUntilUtc.ToString("r")); } - + // Shorcut action execution. filterContext.Result = new FileContentResult(cacheItem.Output, cacheItem.ContentType); - response.StatusCode = cacheItem.StatusCode; + // Add ETag header + if (HttpRuntime.UsingIntegratedPipeline && response.Headers.Get("ETag") == null) { + response.Headers["ETag"] = cacheItem.ETag; + } + + // Check ETag in request + // https://www.w3.org/2005/MWI/BPWG/techs/CachingWithETag.html + var etag = request.Headers["If-None-Match"]; + if (!String.IsNullOrEmpty(etag)) { + if (String.Equals(etag, cacheItem.ETag, StringComparison.Ordinal)) { + // ETag matches the cached item, we return a 304 + filterContext.Result = new HttpStatusCodeResult(HttpStatusCode.NotModified); + return; + } + } + ApplyCacheControl(response); } @@ -509,15 +534,6 @@ namespace Orchard.OutputCache.Filters { // response.DisableKernelCache(); // response.Cache.SetOmitVaryStar(true); - // An ETag is a string that uniquely identifies a specific version of a component. - // We use the cache item to detect if it's a new one. - if (HttpRuntime.UsingIntegratedPipeline) { - if (response.Headers.Get("ETag") == null) { - // What is the point of GetHashCode() of a newly generated item? /DanielStolt - response.Cache.SetETag(new CacheItem().GetHashCode().ToString(CultureInfo.InvariantCulture)); - } - } - if (CacheSettings.VaryByQueryStringParameters == null) { response.Cache.VaryByParams["*"] = true; } diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Models/CacheItem.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Models/CacheItem.cs index 29243df6f..aeeff8af0 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Models/CacheItem.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Models/CacheItem.cs @@ -4,7 +4,7 @@ namespace Orchard.OutputCache.Models { [Serializable] public class CacheItem { // used for serialization compatibility - public static readonly string Version = "1"; + public static readonly string Version = "2"; public DateTime CachedOnUtc { get; set; } public int Duration { get; set; } @@ -18,6 +18,7 @@ namespace Orchard.OutputCache.Models { public string Tenant { get; set; } public int StatusCode { get; set; } public string[] Tags { get; set; } + public string ETag { get; set; } public int ValidFor { get { return Duration; } diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Services/DefaultCacheStorageProvider.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Services/DefaultCacheStorageProvider.cs index a74a3adea..23d1b7ed9 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Services/DefaultCacheStorageProvider.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Services/DefaultCacheStorageProvider.cs @@ -16,6 +16,7 @@ namespace Orchard.OutputCache.Services { } public void Set(string key, CacheItem cacheItem) { + _workContext.HttpContext.Cache.Remove(key); _workContext.HttpContext.Cache.Add( key, cacheItem, From 82c9baad18fc0e97f90241ac07fbc5a7149300a3 Mon Sep 17 00:00:00 2001 From: andy zheng Date: Mon, 14 Mar 2016 18:06:10 -0400 Subject: [PATCH 23/25] fixed a typo in defaultorchardShell --- src/Orchard/Environment/DefaultOrchardShell.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard/Environment/DefaultOrchardShell.cs b/src/Orchard/Environment/DefaultOrchardShell.cs index 603461e54..35053d3da 100644 --- a/src/Orchard/Environment/DefaultOrchardShell.cs +++ b/src/Orchard/Environment/DefaultOrchardShell.cs @@ -108,7 +108,7 @@ namespace Orchard.Environment { throw; } - Logger.Error(ex, "An unexcepted error occured while terminating the Shell"); + Logger.Error(ex, "An unexpected error occured while terminating the Shell"); } } } From 9a2c08d31e1d33462debafa391deb33bbaaa01b8 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Wed, 16 Mar 2016 16:34:32 -0700 Subject: [PATCH 24/25] Fixing tenant load retry logic --- src/Orchard/Environment/DefaultOrchardHost.cs | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Orchard/Environment/DefaultOrchardHost.cs b/src/Orchard/Environment/DefaultOrchardHost.cs index d69a380f9..239600121 100644 --- a/src/Orchard/Environment/DefaultOrchardHost.cs +++ b/src/Orchard/Environment/DefaultOrchardHost.cs @@ -146,26 +146,28 @@ namespace Orchard.Environment { // Not the first attempt, wait for a while ... if (DelayRetries && i > 0) { - // Waits for i^2 which means 1, 2, 4, 8 ... seconds + + // Wait for i^2 which means 1, 2, 4, 8 ... seconds Thread.Sleep(TimeSpan.FromSeconds(Math.Pow(i, 2))); } - bool failed = false; try { var context = CreateShellContext(settings); ActivateShell(context); - } - catch (Exception ex) { - // An exception at this point is always fatal as it literally kills the - // tenant. What is more fatal than something that kills you? - Logger.Error(ex, "A tenant could not be started: " + settings.Name + " Attempt number: " + i); - failed = true; - } - if(failed && i == Retries) { - Logger.Fatal("A tenant could not be started: {0} after {1} retries.", settings.Name, Retries); + // If everything went well, return to stop the retry loop return; } + catch (Exception ex) { + if (i == Retries) { + Logger.Fatal("A tenant could not be started: {0} after {1} retries.", settings.Name, Retries); + return; + } + else { + Logger.Error(ex, "A tenant could not be started: " + settings.Name + " Attempt number: " + i); + } + } + } while (_processingEngine.AreTasksPending()) { From c4dd5a9e187bb953cc58cb86f88613426d7e6ff6 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Wed, 16 Mar 2016 16:34:45 -0700 Subject: [PATCH 25/25] Updating Rebracer settings --- src/Rebracer.xml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Rebracer.xml b/src/Rebracer.xml index f297d32dd..f03770665 100644 --- a/src/Rebracer.xml +++ b/src/Rebracer.xml @@ -10,8 +10,8 @@ - TODO:2 - HACK:2 + HACK:2 + TODO:2 UNDONE:2 UnresolvedMergeConflict:3 @@ -42,6 +42,7 @@ 0 1 1 + 1 0 0 0 @@ -50,6 +51,7 @@ 0 0 0 + 1 0 1 1 @@ -128,12 +130,19 @@ false true true + false false false + false + false + false + false + false true false false true + true true false true @@ -145,6 +154,8 @@ true 2 2 + false + false 0 true true @@ -200,6 +211,7 @@ false true false + false true true @@ -225,6 +237,9 @@ false false false + false + false + false false false @@ -233,6 +248,7 @@ true true true + true true true true