Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 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
c64e1b3
Removing the RadioValueEditor.cs & RadioValueValidator.cs obsoleted c…
NillasKA Aug 21, 2025
9d14598
Removing obsolete constructor from MultipleValueValidator.cs
NillasKA Aug 21, 2025
dd92969
Removing obsolete constructor from EmailValidator.cs
NillasKA Aug 21, 2025
fe5c504
Removing obsoleted code from DataValueReferenceFactoryCollection.cs
NillasKA Aug 21, 2025
167a845
Removing obsoleted code from ApiContentBuilderBase.cs
NillasKA Aug 21, 2025
cf6bdb1
Fixing constructor missing attribute
NillasKA Aug 25, 2025
10d2629
Making use of the TryGet result
NillasKA Aug 25, 2025
47af906
Fixing use of obsoleted constructor
NillasKA Aug 25, 2025
680f051
Removing silly bookmark comment
NillasKA Aug 25, 2025
74c5df6
Fixing deleted code and restructuring to use new cache
NillasKA Aug 26, 2025
5c4fb39
Making use of TryGetRootKeys bool, to return null if false.
NillasKA Aug 26, 2025
135cb84
Extending code to use new constructor
NillasKA Aug 26, 2025
c0310bb
Updated PublishedContentQuery.cs to return empty array
NillasKA Aug 26, 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
11 changes: 8 additions & 3 deletions src/Umbraco.Cms.Api.Delivery/Services/ApiMediaQueryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ private IPublishedMediaCache GetRequiredPublishedMediaCache()
private IPublishedContent? TryGetByPath(string path, IPublishedMediaCache mediaCache)
{
var segments = path.Split(Constants.CharArrays.ForwardSlash, StringSplitOptions.RemoveEmptyEntries);
IEnumerable<IPublishedContent> currentChildren = mediaCache.GetAtRoot();
if (_mediaNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys) is false)
{
return null;
}

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

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

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

IPublishedContent? parent = Guid.TryParse(childrenOf, out Guid parentKey)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Extensions.DependencyInjection;

Check notice on line 1 in src/Umbraco.Core/Cache/Refreshers/Implement/ContentCacheRefresher.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v17/dev)

✅ No longer an issue: Constructor Over-Injection

ContentCacheRefresher is no longer above the threshold for number of arguments. This constructor has too many arguments, indicating an object with low cohesion or missing function argument abstraction. Avoid adding more arguments.
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models;
Expand Down Expand Up @@ -27,39 +27,6 @@
private readonly IPublishStatusManagementService _publishStatusManagementService;
private readonly IIdKeyMap _idKeyMap;

[Obsolete("Use the constructor with ICacheManager instead, scheduled for removal in V17.")]
public ContentCacheRefresher(
AppCaches appCaches,
IJsonSerializer serializer,
IIdKeyMap idKeyMap,
IDomainService domainService,
IEventAggregator eventAggregator,
ICacheRefresherNotificationFactory factory,
IDocumentUrlService documentUrlService,
IDomainCacheService domainCacheService,
IDocumentNavigationQueryService documentNavigationQueryService,
IDocumentNavigationManagementService documentNavigationManagementService,
IContentService contentService,
IPublishStatusManagementService publishStatusManagementService,
IDocumentCacheService documentCacheService)
: this(
appCaches,
serializer,
idKeyMap,
domainService,
eventAggregator,
factory,
documentUrlService,
domainCacheService,
documentNavigationQueryService,
documentNavigationManagementService,
contentService,
publishStatusManagementService,
documentCacheService,
StaticServiceProvider.Instance.GetRequiredService<ICacheManager>())
{
}

public ContentCacheRefresher(
AppCaches appCaches,
IJsonSerializer serializer,
Expand Down
25 changes: 0 additions & 25 deletions src/Umbraco.Core/Cache/Refreshers/Implement/MediaCacheRefresher.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Extensions.DependencyInjection;

Check notice on line 1 in src/Umbraco.Core/Cache/Refreshers/Implement/MediaCacheRefresher.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v17/dev)

✅ No longer an issue: Constructor Over-Injection

MediaCacheRefresher is no longer above the threshold for number of arguments. This constructor has too many arguments, indicating an object with low cohesion or missing function argument abstraction. Avoid adding more arguments.
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models;
Expand All @@ -22,31 +22,6 @@
private readonly IMediaCacheService _mediaCacheService;
private readonly ICacheManager _cacheManager;

[Obsolete("Use the constructor with ICacheManager instead, scheduled for removal in V17.")]
public MediaCacheRefresher(
AppCaches appCaches,
IJsonSerializer serializer,
IIdKeyMap idKeyMap,
IEventAggregator eventAggregator,
ICacheRefresherNotificationFactory factory,
IMediaNavigationQueryService mediaNavigationQueryService,
IMediaNavigationManagementService mediaNavigationManagementService,
IMediaService mediaService,
IMediaCacheService mediaCacheService)
: this(
appCaches,
serializer,
idKeyMap,
eventAggregator,
factory,
mediaNavigationQueryService,
mediaNavigationManagementService,
mediaService,
mediaCacheService,
StaticServiceProvider.Instance.GetRequiredService<ICacheManager>())
{
}

public MediaCacheRefresher(
AppCaches appCaches,
IJsonSerializer serializer,
Expand Down
17 changes: 1 addition & 16 deletions src/Umbraco.Core/DeliveryApi/ApiContentBuilderBase.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Models.DeliveryApi;
using Umbraco.Cms.Core.Models.DeliveryApi;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Extensions;

Expand All @@ -12,19 +10,6 @@ public abstract class ApiContentBuilderBase<T>
private readonly IApiContentNameProvider _apiContentNameProvider;
private readonly IOutputExpansionStrategyAccessor _outputExpansionStrategyAccessor;

[Obsolete("Please use the constructor that takes all parameters. Scheduled for removal in Umbraco 17.")]
protected ApiContentBuilderBase(
IApiContentNameProvider apiContentNameProvider,
IApiContentRouteBuilder apiContentRouteBuilder,
IOutputExpansionStrategyAccessor outputExpansionStrategyAccessor)
: this(
apiContentNameProvider,
apiContentRouteBuilder,
outputExpansionStrategyAccessor,
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>())
{
}

protected ApiContentBuilderBase(
IApiContentNameProvider apiContentNameProvider,
IApiContentRouteBuilder apiContentRouteBuilder,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.Editors;

Expand All @@ -17,17 +15,6 @@ public class DataValueReferenceFactoryCollection : BuilderCollectionBase<IDataVa

private readonly ILogger<DataValueReferenceFactoryCollection> _logger;

/// <summary>
/// Initializes a new instance of the <see cref="DataValueReferenceFactoryCollection" /> class.
/// </summary>
/// <param name="items">The items.</param>
[Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 17.")]
public DataValueReferenceFactoryCollection(Func<IEnumerable<IDataValueReferenceFactory>> items)
: this(
items,
StaticServiceProvider.Instance.GetRequiredService<ILogger<DataValueReferenceFactoryCollection>>())
{ }

/// <summary>
/// Initializes a new instance of the <see cref="DataValueReferenceFactoryCollection" /> class.
/// </summary>
Expand Down Expand Up @@ -159,17 +146,6 @@ private IEnumerable<UmbracoEntityReference> GetReferencesFromPropertyValues(IEnu
return result;
}

/// <summary>
/// Gets all relation type aliases that are automatically tracked.
/// </summary>
/// <param name="propertyEditors">The property editors.</param>
/// <returns>
/// All relation type aliases that are automatically tracked.
/// </returns>
[Obsolete("Use GetAllAutomaticRelationTypesAliases. This will be removed in Umbraco 15.")]
public ISet<string> GetAutomaticRelationTypesAliases(PropertyEditorCollection propertyEditors) =>
GetAllAutomaticRelationTypesAliases(propertyEditors);

public ISet<string> GetAllAutomaticRelationTypesAliases(PropertyEditorCollection propertyEditors)
{
// Always add default automatic relation types
Expand Down
18 changes: 0 additions & 18 deletions src/Umbraco.Core/PropertyEditors/RadioValueEditor.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/Umbraco.Core/PropertyEditors/Validators/EmailValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ public sealed class EmailValidator : IValueValidator
{
private readonly ILocalizedTextService _localizedTextService;

/// <summary>
/// Initializes a new instance of the <see cref="EmailValidator"/> class.
/// </summary>
[Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 17.")]
public EmailValidator()
: this(StaticServiceProvider.Instance.GetRequiredService<ILocalizedTextService>())
{
}

/// <summary>
/// Initializes a new instance of the <see cref="EmailValidator"/> class.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ public class MultipleValueValidator : IValueValidator
{
private readonly ILocalizedTextService _localizedTextService;

/// <summary>
/// Initializes a new instance of the <see cref="MultipleValueValidator"/> class.
/// </summary>
[Obsolete("Please use the constructor that takes all parameters. Scheduled for removal in Umbraco 17.")]
public MultipleValueValidator()
: this(StaticServiceProvider.Instance.GetRequiredService<ILocalizedTextService>())
{
}

/// <summary>
/// Initializes a new instance of the <see cref="MultipleValueValidator"/> class.
/// </summary>
Expand Down
35 changes: 0 additions & 35 deletions src/Umbraco.Core/PropertyEditors/Validators/RadioValueValidator.cs

This file was deleted.

55 changes: 0 additions & 55 deletions src/Umbraco.Core/PublishedCache/IPublishedCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ public interface IPublishedCache
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
IPublishedContent? GetById(bool preview, Guid contentId);

/// <summary>
/// Gets a content identified by its Udi identifier.
/// </summary>
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
/// <param name="contentId">The content Udi identifier.</param>
/// <returns>The content, or null.</returns>
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
[Obsolete] // FIXME: Remove when replacing nucache
IPublishedContent? GetById(bool preview, Udi contentId);

/// <summary>
/// Gets a content identified by its unique identifier.
/// </summary>
Expand All @@ -50,49 +40,4 @@ public interface IPublishedCache
/// <returns>The content, or null.</returns>
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
IPublishedContent? GetById(Guid contentId);

/// <summary>
/// Gets a content identified by its unique identifier.
/// </summary>
/// <param name="contentId">The content unique identifier.</param>
/// <returns>The content, or null.</returns>
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
[Obsolete] // FIXME: Remove when replacing nucache
IPublishedContent? GetById(Udi contentId);

/// <summary>
/// Gets contents at root.
/// </summary>
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
/// <param name="culture">A culture.</param>
/// <returns>The contents.</returns>
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
[Obsolete("Scheduled for removal, use IDocumentNavigationQueryService instead in v17")]
IEnumerable<IPublishedContent> GetAtRoot(bool preview, string? culture = null);

/// <summary>
/// Gets contents at root.
/// </summary>
/// <param name="culture">A culture.</param>
/// <returns>The contents.</returns>
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
[Obsolete("Scheduled for removal, use IDocumentNavigationQueryService instead in v17")]
IEnumerable<IPublishedContent> GetAtRoot(string? culture = null);

/// <summary>
/// Gets a value indicating whether the cache contains published content.
/// </summary>
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
/// <returns>A value indicating whether the cache contains published content.</returns>
/// <remarks>The value of <paramref name="preview" /> overrides defaults.</remarks>
[Obsolete("Scheduled for removal in v17")]
bool HasContent(bool preview);

/// <summary>
/// Gets a value indicating whether the cache contains published content.
/// </summary>
/// <returns>A value indicating whether the cache contains published content.</returns>
/// <remarks>Considers published or unpublished content depending on defaults.</remarks>
[Obsolete("Scheduled for removal in v17")]
bool HasContent();
}
40 changes: 0 additions & 40 deletions src/Umbraco.Core/PublishedCache/IPublishedContentCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,46 +44,6 @@ public interface IPublishedContentCache : IPublishedCache
/// <para>The value of <paramref name="preview" /> overrides defaults.</para>
/// </remarks>
[Obsolete]
IPublishedContent? GetByRoute(bool preview, string route, bool? hideTopLevelNode = null, string? culture = null);

/// <summary>
/// Gets content identified by a route.
/// </summary>
/// <param name="route">The route</param>
/// <param name="hideTopLevelNode">A value forcing the HideTopLevelNode setting.</param>
/// <param name="culture">The culture</param>
/// <returns>The content, or null.</returns>
/// <remarks>
/// <para>
/// A valid route is either a simple path eg <c>/foo/bar/nil</c> or a root node id and a path, eg
/// <c>123/foo/bar/nil</c>.
/// </para>
/// <para>
/// If
/// <paramref name="hideTopLevelNode" />
/// is <c>null</c> then the settings value is used.
/// </para>
/// <para>Considers published or unpublished content depending on defaults.</para>
/// </remarks>
[Obsolete]
IPublishedContent? GetByRoute(string route, bool? hideTopLevelNode = null, string? culture = null);

/// <summary>
/// Gets the route for a content identified by its unique identifier.
/// </summary>
/// <param name="preview">A value indicating whether to consider unpublished content.</param>
/// <param name="contentId">The content unique identifier.</param>
/// <param name="culture">The culture</param>
/// <returns>A special string formatted route path.</returns>
/// <remarks>
/// <para>
/// The resulting string is a special encoded route string that may contain the domain ID
/// for the current route. If a domain is present the string will be prefixed with the domain ID integer, example:
/// {domainId}/route-path-of-item
/// </para>
/// <para>The value of <paramref name="preview" /> overrides defaults.</para>
/// </remarks>
[Obsolete]
string? GetRouteById(bool preview, int contentId, string? culture = null);

/// <summary>
Expand Down
11 changes: 0 additions & 11 deletions src/Umbraco.Core/PublishedCache/PublishedCacheBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,10 @@ public PublishedCacheBase(IVariationContextAccessor variationContextAccessor, bo
public IPublishedContent? GetById(Guid contentId)
=> GetById(PreviewDefault, contentId);

public abstract IPublishedContent? GetById(bool preview, Udi contentId);

public IPublishedContent? GetById(Udi contentId)
=> GetById(PreviewDefault, contentId);

public abstract bool HasById(bool preview, int contentId);

public bool HasById(int contentId)
=> HasById(PreviewDefault, contentId);

public abstract IEnumerable<IPublishedContent> GetAtRoot(bool preview, string? culture = null);

public IEnumerable<IPublishedContent> GetAtRoot(string? culture = null) => GetAtRoot(PreviewDefault, culture);

public abstract bool HasContent(bool preview);

public bool HasContent() => HasContent(PreviewDefault);
}
Loading