v10: Fix build warnings in Web.Common (#12349)
* Run code cleanup * Run dotnet format * Start manual cleanup in Web.Common * Finish up manual cleanup * Fix tests * Fix up InMemoryModelFactory.cs * Inject proper macroRenderer * Update src/Umbraco.Web.Common/Filters/JsonDateTimeFormatAttribute.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Web.Common/Filters/ValidateUmbracoFormRouteStringAttribute.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Fix based on review Co-authored-by: Nikolaj Geisle <niko737@edu.ucl.dk> Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
This commit is contained in:
@@ -4,33 +4,34 @@ using SixLabors.ImageSharp.Web.Caching;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Web.Common.DependencyInjection
|
||||
namespace Umbraco.Cms.Web.Common.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// Configures the ImageSharp physical file system cache options.
|
||||
/// </summary>
|
||||
/// <seealso cref="IConfigureOptions{PhysicalFileSystemCacheOptions}" />
|
||||
public sealed class ConfigurePhysicalFileSystemCacheOptions : IConfigureOptions<PhysicalFileSystemCacheOptions>
|
||||
{
|
||||
private readonly IHostEnvironment _hostEnvironment;
|
||||
private readonly ImagingSettings _imagingSettings;
|
||||
|
||||
/// <summary>
|
||||
/// Configures the ImageSharp physical file system cache options.
|
||||
/// Initializes a new instance of the <see cref="ConfigurePhysicalFileSystemCacheOptions" /> class.
|
||||
/// </summary>
|
||||
/// <seealso cref="IConfigureOptions{PhysicalFileSystemCacheOptions}" />
|
||||
public sealed class ConfigurePhysicalFileSystemCacheOptions : IConfigureOptions<PhysicalFileSystemCacheOptions>
|
||||
/// <param name="imagingSettings">The Umbraco imaging settings.</param>
|
||||
/// <param name="hostEnvironment">The host environment.</param>
|
||||
public ConfigurePhysicalFileSystemCacheOptions(
|
||||
IOptions<ImagingSettings> imagingSettings,
|
||||
IHostEnvironment hostEnvironment)
|
||||
{
|
||||
private readonly ImagingSettings _imagingSettings;
|
||||
private readonly IHostEnvironment _hostEnvironment;
|
||||
_imagingSettings = imagingSettings.Value;
|
||||
_hostEnvironment = hostEnvironment;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ConfigurePhysicalFileSystemCacheOptions" /> class.
|
||||
/// </summary>
|
||||
/// <param name="imagingSettings">The Umbraco imaging settings.</param>
|
||||
/// <param name="hostEnvironment">The host environment.</param>
|
||||
public ConfigurePhysicalFileSystemCacheOptions(IOptions<ImagingSettings> imagingSettings, IHostEnvironment hostEnvironment)
|
||||
{
|
||||
_imagingSettings = imagingSettings.Value;
|
||||
_hostEnvironment = hostEnvironment;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Configure(PhysicalFileSystemCacheOptions options)
|
||||
{
|
||||
options.CacheFolder = _hostEnvironment.MapPathContentRoot(_imagingSettings.Cache.CacheFolder);
|
||||
options.CacheFolderDepth = _imagingSettings.Cache.CacheFolderDepth;
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public void Configure(PhysicalFileSystemCacheOptions options)
|
||||
{
|
||||
options.CacheFolder = _hostEnvironment.MapPathContentRoot(_imagingSettings.Cache.CacheFolder);
|
||||
options.CacheFolderDepth = _imagingSettings.Cache.CacheFolderDepth;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user