From 34b65404e0fead814eb09444a5bba2fc837c5ee2 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Wed, 18 Aug 2021 10:01:33 +0200 Subject: [PATCH 1/3] Move default ImageSharp cache folder to TEMP and map configured value to content root --- .../Configuration/Models/ImagingCacheSettings.cs | 6 +++--- .../DependencyInjection/UmbracoBuilder.ImageSharp.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs b/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs index 18fc5ccd93..cd7d2fda1b 100644 --- a/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs @@ -12,10 +12,10 @@ namespace Umbraco.Cms.Core.Configuration.Models /// public class ImagingCacheSettings { - internal const string StaticBrowserMaxAge = "7.00:00:00"; // TimeSpan.FromDays(7); - internal const string StaticCacheMaxAge = "365.00:00:00"; // TimeSpan.FromDays(365); + internal const string StaticBrowserMaxAge = "7.00:00:00"; + internal const string StaticCacheMaxAge = "365.00:00:00"; internal const int StaticCachedNameLength = 8; - internal const string StaticCacheFolder = "../umbraco/mediacache"; + internal const string StaticCacheFolder = Constants.SystemDirectories.TempData + "/MediaCache"; /// /// Gets or sets a value for the browser image cache maximum age. diff --git a/src/Umbraco.Web.Common/DependencyInjection/UmbracoBuilder.ImageSharp.cs b/src/Umbraco.Web.Common/DependencyInjection/UmbracoBuilder.ImageSharp.cs index 280d48f64b..62573cfc7b 100644 --- a/src/Umbraco.Web.Common/DependencyInjection/UmbracoBuilder.ImageSharp.cs +++ b/src/Umbraco.Web.Common/DependencyInjection/UmbracoBuilder.ImageSharp.cs @@ -51,7 +51,7 @@ namespace Umbraco.Extensions return Task.CompletedTask; }; }) - .Configure(options => options.CacheFolder = imagingSettings.Cache.CacheFolder) + .Configure(options => options.CacheFolder = builder.BuilderHostingEnvironment.MapPathContentRoot(imagingSettings.Cache.CacheFolder)) // We need to add CropWebProcessor before ResizeWebProcessor (until https://github.com/SixLabors/ImageSharp.Web/issues/182 is fixed) .RemoveProcessor() .AddProcessor() From d6cfc900f303cc48a96335c5bd135ebe34d4a9c2 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Wed, 18 Aug 2021 10:02:34 +0200 Subject: [PATCH 2/3] Remove is-cache folder form gitignore and fix minor formatting --- .gitignore | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index fb5e701d1c..0218f38ec7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ # -# Umbraco Cms Git Ignore +# Umbraco CMS .gitignore # -# common files +# Common files *.obj *.pdb *.user @@ -15,19 +15,19 @@ *.ndproj *.ignorer.* -# common directories +# Common directories .DS_Store ._.DS_Store .vs/ /local/ -# build directories +# Build directories [Bb]in/ [Db]ebug*/ [Rr]elease*/ obj/ -# tools +# Tools _ReSharper*/ _NCrunch_*/ *.ncrunchsolution @@ -36,9 +36,6 @@ _NCrunch_*/ *.crunchsolution.cache tools/NDepend/ - - - [Tt]est[Rr]esult* [Bb]uild[Ll]og.* *.[Pp]ublish.xml @@ -133,10 +130,10 @@ src/Umbraco.Web.UI.Client/bower_components/* /src/Umbraco.Web.UI/[Uu]mbraco/preview /src/Umbraco.Web.UI/[Uu]mbraco/preview.old -# ignore rule for clearing out Belle (avoid rebuilding all the time) +# Ignore rule for clearing out Belle (avoid rebuilding all the time) preserve.belle -#Ignore Rule for output of generated documentation files from Grunt docserve +# Ignore rule for output of generated documentation files from grunt docserve src/Umbraco.Web.UI.Docs/api src/Umbraco.Web.UI.Docs/package-lock.json src/*.boltdata/ @@ -157,13 +154,12 @@ build/csharp-docs.zip src/packages/ src/PrecompiledWeb/* -# build +# Build build.out/ build.tmp/ build/hooks/ build/temp/ - # Acceptance tests cypress.env.json /src/Umbraco.Tests.AcceptanceTest/cypress/support/chainable.ts @@ -172,13 +168,10 @@ cypress.env.json /src/Umbraco.Tests.AcceptanceTest/cypress/screenshots/ src/Umbraco.Web.UI/Umbraco/telemetrics-id.umb - -# eof /src/Umbraco.Web.UI.Client/TESTS-*.xml /src/ApiDocs/api/* /src/Umbraco.Web.UI.Client/package-lock.json /src/Umbraco.Web.UI.NetCore/wwwroot/Media/* -/src/Umbraco.Web.UI.NetCore/wwwroot/is-cache/* /src/Umbraco.Tests.Integration/App_Data/* /src/Umbraco.Tests.Integration/TEMP/* /src/Umbraco.Web.UI.NetCore/wwwroot/[Uu]mbraco/assets/* @@ -204,7 +197,6 @@ src/Umbraco.Tests.Integration/Views/ src/Umbraco.Tests/TEMP/ - /src/Umbraco.Web.UI/config/umbracoSettings.config src/Umbraco.Tests.UnitTests/umbraco/Data/TEMP/ From 7ccc434bd6d12b18470a13dc0c4c2aec1b29ff3b Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Thu, 19 Aug 2021 09:08:12 +0200 Subject: [PATCH 3/3] Inject IHostingEnvironment to UmbracoBuilder to fix integration tests --- .../TestServerTest/UmbracoTestServerTestBase.cs | 6 ++++-- .../Testing/UmbracoIntegrationTest.cs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Tests.Integration/TestServerTest/UmbracoTestServerTestBase.cs b/src/Umbraco.Tests.Integration/TestServerTest/UmbracoTestServerTestBase.cs index 71b9ac3ef9..96681c67da 100644 --- a/src/Umbraco.Tests.Integration/TestServerTest/UmbracoTestServerTestBase.cs +++ b/src/Umbraco.Tests.Integration/TestServerTest/UmbracoTestServerTestBase.cs @@ -134,15 +134,17 @@ namespace Umbraco.Cms.Tests.Integration.TestServerTest public override void ConfigureServices(IServiceCollection services) { services.AddTransient(); + + Core.Hosting.IHostingEnvironment hostingEnvironment = TestHelper.GetHostingEnvironment(); TypeLoader typeLoader = services.AddTypeLoader( GetType().Assembly, - TestHelper.GetHostingEnvironment(), + hostingEnvironment, TestHelper.ConsoleLoggerFactory, AppCaches.NoCache, Configuration, TestHelper.Profiler); - var builder = new UmbracoBuilder(services, Configuration, typeLoader); + var builder = new UmbracoBuilder(services, Configuration, typeLoader, TestHelper.ConsoleLoggerFactory, TestHelper.Profiler, AppCaches.NoCache, hostingEnvironment); builder .AddConfiguration() diff --git a/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs b/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs index bb4be6f368..314a614b49 100644 --- a/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs +++ b/src/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs @@ -212,7 +212,7 @@ namespace Umbraco.Cms.Tests.Integration.Testing TestHelper.Profiler); var builder = new UmbracoBuilder(services, Configuration, typeLoader, TestHelper.ConsoleLoggerFactory, TestHelper.Profiler, AppCaches.NoCache, hostingEnvironment); - builder.Services.AddLogger(TestHelper.GetHostingEnvironment(), TestHelper.GetLoggingConfiguration(), Configuration); + builder.Services.AddLogger(hostingEnvironment, TestHelper.GetLoggingConfiguration(), Configuration); builder.AddConfiguration() .AddUmbracoCore()