Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1f2c9e8
Removing obsoleted code from ApiMediaQueryService.cs
NillasKA Aug 21, 2025
a5b1436
Removing obsoleted code from ApiRichTextMarkupParserTests.cs
NillasKA Aug 21, 2025
40e7479
Removing obsoleted code from ContentCacheRefresher.cs
NillasKA Aug 21, 2025
3b1d819
Removing obsoleted code from ContentFinderByUrlAlias.cs and adjusting…
NillasKA Aug 21, 2025
2411360
Removing obsoleted code from ContentFinderByUrl.cs & its dependencies
NillasKA Aug 21, 2025
802539a
Removing obsoleted code from ApiRichTextMarkupParserTests.cs
NillasKA Aug 21, 2025
b19a7b5
Removing obsoleted code from DocumentCache.cs & its dependencies
NillasKA Aug 21, 2025
a57250e
Removing obsoleted code from MediaCache.cs & its dependencies
NillasKA Aug 21, 2025
158305f
Removing obsoleted code from PublishedCacheBase.cs & its dependencies
NillasKA Aug 21, 2025
67fdcfe
Removing obsoleted code from RenderNoContentController.cs and its tests
NillasKA Aug 21, 2025
12187bf
Removing obsoleted code from UmbracoRouteValueTransformer.cs
NillasKA Aug 21, 2025
36a0db5
Removing obsoleted constructors from DefaultUrlProvider.cs
NillasKA Aug 21, 2025
76bee22
Removing accidental bookmark
NillasKA Aug 21, 2025
2d6bf16
Introducing a helper method to get the root keys in ApiMediaQueryServ…
NillasKA Aug 22, 2025
3085a6d
Removing obsoleted code from Cache classes
NillasKA Aug 22, 2025
bc4406f
Removing unused imports
NillasKA Aug 22, 2025
581d67d
Refactoring to meet the CR
NillasKA Aug 22, 2025
b266220
Added attribute to controller
NillasKA Aug 22, 2025
7c6b22a
Merge branch 'v17/dev' into v17/cache-rm-obsolete
NillasKA Aug 27, 2025
3673e24
Fixing missing using statement
NillasKA Aug 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/Umbraco.Cms.Api.Delivery/Services/ApiMediaQueryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,7 @@ private IPublishedMediaCache GetRequiredPublishedMediaCache()
private IPublishedContent? TryGetByPath(string path, IPublishedMediaCache mediaCache)
{
var segments = path.Split(Constants.CharArrays.ForwardSlash, StringSplitOptions.RemoveEmptyEntries);
if (_mediaNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys) is false)
{
return null;
}

IEnumerable<IPublishedContent> currentChildren = rootKeys.Select(x => mediaCache.GetById(false, x)).WhereNotNull();
IEnumerable<IPublishedContent> currentChildren = GetRootContent(mediaCache);
IPublishedContent? resolvedMedia = null;

foreach (var segment in segments)
Expand Down Expand Up @@ -106,9 +101,9 @@ private IPublishedMediaCache GetRequiredPublishedMediaCache()
}

IPublishedMediaCache mediaCache = GetRequiredPublishedMediaCache();
if (childrenOf.Trim(Constants.CharArrays.ForwardSlash).Length == 0 && _mediaNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys))
if (childrenOf.Trim(Constants.CharArrays.ForwardSlash).Length == 0)
{
return rootKeys.Select(x => mediaCache.GetById(false, x)).WhereNotNull();
return GetRootContent(mediaCache);
}

IPublishedContent? parent = Guid.TryParse(childrenOf, out Guid parentKey)
Expand Down Expand Up @@ -201,4 +196,8 @@ private static Attempt<PagedModel<Guid>, ApiMediaQueryOperationStatus> PagedResu

return Attempt.SucceedWithStatus(ApiMediaQueryOperationStatus.Success, result);
}

private IEnumerable<IPublishedContent> GetRootContent(IPublishedMediaCache mediaCache)
=> _mediaNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys) is false ? []
: rootKeys.Select(x => mediaCache.GetById(false, x)).WhereNotNull();
}
6 changes: 4 additions & 2 deletions src/Umbraco.PublishedCache.HybridCache/DocumentCache.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Core.Routing;
Expand Down Expand Up @@ -45,7 +44,10 @@ public DocumentCache(

public IEnumerable<IPublishedContent> GetAtRoot(bool preview, string? culture = null)
{
_documentNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys);
if (_documentNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys) is false)
{
return [];
}

IEnumerable<IPublishedContent> rootContent = rootKeys.Select(key => GetById(preview, key)).WhereNotNull();
return culture is null ? rootContent : rootContent.Where(x => x.IsInvariantOrHasCulture(culture));
Expand Down
6 changes: 4 additions & 2 deletions src/Umbraco.PublishedCache.HybridCache/MediaCache.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Core.Services.Navigation;
Expand Down Expand Up @@ -35,7 +34,10 @@ public MediaCache(IMediaCacheService mediaCacheService, IPublishedContentTypeCac

public IEnumerable<IPublishedContent> GetAtRoot(bool preview, string? culture = null)
{
_mediaNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys);
if (_mediaNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys) is false)
{
return [];
}

IEnumerable<IPublishedContent> rootContent = rootKeys.Select(key => GetById(preview, key)).WhereNotNull();
return culture is null ? rootContent : rootContent.Where(x => x.IsInvariantOrHasCulture(culture));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Reflection;
using System.Threading.Tasks;
using Lucene.Net.Search.Similarities;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Controllers;
Expand All @@ -13,15 +11,11 @@
using NUnit.Framework;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Core.Routing;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Web;
using Umbraco.Cms.Tests.UnitTests.TestHelpers;
using Umbraco.Cms.Web.Common.Controllers;
using Umbraco.Cms.Web.Common.Filters;
using Umbraco.Cms.Web.Common.Routing;
using Umbraco.Cms.Web.Website.Controllers;
using Umbraco.Cms.Web.Website.Routing;
Expand Down