From a46d40e9ef3c782ddd5a339a7b32bf34f9b8b54b Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 15 Feb 2019 10:31:45 +0100 Subject: [PATCH 1/3] Fix UmbracoContext issue (with a TODO) --- .../PublishedCache/DefaultCultureAccessor.cs | 12 ++++++++---- src/Umbraco.Web/UmbracoInjectedModule.cs | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/DefaultCultureAccessor.cs b/src/Umbraco.Web/PublishedCache/DefaultCultureAccessor.cs index 80d2d9f3a5..ef6a6dd8da 100644 --- a/src/Umbraco.Web/PublishedCache/DefaultCultureAccessor.cs +++ b/src/Umbraco.Web/PublishedCache/DefaultCultureAccessor.cs @@ -1,4 +1,5 @@ -using Umbraco.Core.Services; +using Umbraco.Core; +using Umbraco.Core.Services; namespace Umbraco.Web.PublishedCache { @@ -8,17 +9,20 @@ namespace Umbraco.Web.PublishedCache public class DefaultCultureAccessor : IDefaultCultureAccessor { private readonly ILocalizationService _localizationService; + private readonly RuntimeLevel _runtimeLevel; /// /// Initializes a new instance of the class. /// - /// - public DefaultCultureAccessor(ILocalizationService localizationService) + public DefaultCultureAccessor(ILocalizationService localizationService, IRuntimeState runtimeState) { _localizationService = localizationService; + _runtimeLevel = runtimeState.Level; } /// - public string DefaultCulture => _localizationService.GetDefaultLanguageIsoCode() ?? ""; // fast + public string DefaultCulture => _runtimeLevel == RuntimeLevel.Run + ? _localizationService.GetDefaultLanguageIsoCode() ?? "" // fast + : "en-US"; // default for install and upgrade, when the service is n/a } } diff --git a/src/Umbraco.Web/UmbracoInjectedModule.cs b/src/Umbraco.Web/UmbracoInjectedModule.cs index 14ae45fe40..6a786ed6bf 100644 --- a/src/Umbraco.Web/UmbracoInjectedModule.cs +++ b/src/Umbraco.Web/UmbracoInjectedModule.cs @@ -95,6 +95,7 @@ namespace Umbraco.Web // ok, process + // TODO: should we move this to after we've ensured we are processing a routable page? // ensure there's an UmbracoContext registered for the current request // registers the context reference so its disposed at end of request var umbracoContextReference = _umbracoContextFactory.EnsureUmbracoContext(httpContext); From 6f0ba2236ff642308ba9b9d1db22b71d1b44f2bd Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 15 Feb 2019 10:32:00 +0100 Subject: [PATCH 2/3] Fix IGlobalSettings.LocalTempPath in tests --- src/Umbraco.Core/Configuration/GlobalSettings.cs | 1 - src/Umbraco.Tests/TestHelpers/SettingsForTests.cs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index 1fd770607c..09962fab5a 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -293,7 +293,6 @@ namespace Umbraco.Core.Configuration case LocalTempStorage.AspNetTemp: return System.IO.Path.Combine(HttpRuntime.CodegenDir, "UmbracoData"); case LocalTempStorage.EnvironmentTemp: - // TODO: why has this to be repeated everywhere?! // include the appdomain hash is just a safety check, for example if a website is moved from worker A to worker B and then back // to worker A again, in theory the %temp% folder should already be empty but we really want to make sure that its not // utilizing an old path - assuming we cannot have SHA1 collisions on AppDomainAppId diff --git a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs index 97fffe11dd..572d572ab7 100644 --- a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs +++ b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs @@ -21,6 +21,7 @@ namespace Umbraco.Tests.TestHelpers settings.TimeOutInMinutes == 20 && settings.DefaultUILanguage == "en" && settings.LocalTempStorageLocation == LocalTempStorage.Default && + settings.LocalTempPath == IOHelper.MapPath("~/App_Data/TEMP") && settings.ReservedPaths == (GlobalSettings.StaticReservedPaths + "~/umbraco") && settings.ReservedUrls == GlobalSettings.StaticReservedUrls); return config; From 7f764a45578e84680063e88dc5cc1a915019938a Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Fri, 15 Feb 2019 11:03:38 +0100 Subject: [PATCH 3/3] Bugfix for checkboxlist --- .../propertyeditors/checkboxlist/checkboxlist.controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/checkboxlist/checkboxlist.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/checkboxlist/checkboxlist.controller.js index 1e679eb5ae..5e7eff0d1e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/checkboxlist/checkboxlist.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/checkboxlist/checkboxlist.controller.js @@ -66,13 +66,13 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.CheckboxListContro function changed(item) { var index = _.findIndex($scope.model.value, function (v) { - return v === item.value; + return v === item.val; }); if (item.checked) { //if it doesn't exist in the model, then add it if (index < 0) { - $scope.model.value.push(item.value); + $scope.model.value.push(item.val); } } else {