Skip to content

Commit

Permalink
Renamed interface to prepare for adding GetPagedRollbackVersions
Browse files Browse the repository at this point in the history
  • Loading branch information
bergmania committed Oct 29, 2021
1 parent b96ec5a commit 698e6b1
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static Composition ComposeServices(this Composition composition)

composition.RegisterUnique<ContentService>();
composition.RegisterUnique<IContentService>(factory => factory.GetInstance<ContentService>());
composition.RegisterUnique<IContentVersionCleanupService>(factory => factory.GetInstance<ContentService>());
composition.RegisterUnique<IContentVersionService>(factory => factory.GetInstance<ContentService>());
composition.RegisterUnique<IContentVersionCleanupPolicy, DefaultContentVersionCleanupPolicy>();

composition.RegisterUnique<IUserService, UserService>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Umbraco.Core.Services
{
public interface IContentVersionCleanupService
public interface IContentVersionService
{
/// <summary>
/// Removes historic content versions according to a policy.
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Services/Implement/ContentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Umbraco.Core.Services.Implement
/// <summary>
/// Implements the content service.
/// </summary>
public class ContentService : RepositoryService, IContentService, IContentVersionCleanupService
public class ContentService : RepositoryService, IContentService, IContentVersionService
{
private readonly IDocumentRepository _documentRepository;
private readonly IEntityRepository _entityRepository;
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Core/Umbraco.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<Compile Include="PropertyEditors\EyeDropperColorPickerConfiguration.cs" />
<Compile Include="PropertyEditors\ComplexPropertyEditorContentEventHandler.cs" />
<Compile Include="Services\IContentVersionCleanupPolicy.cs" />
<Compile Include="Services\IContentVersionCleanupService.cs" />
<Compile Include="Services\IContentVersionService.cs" />
<Compile Include="Services\IIconService.cs" />
<Compile Include="Services\Implement\DefaultContentVersionCleanupPolicy.cs" />
<Compile Include="Services\Implement\InstallationService.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ContentVersionCleanup_Tests_UnitTests
public void ContentVersionCleanup_WhenNotEnabled_DoesNotCleanupWillRepeat(
[Frozen] Mock<IContentVersionCleanupPolicyGlobalSettings> settings,
[Frozen] Mock<IRuntimeState> state,
[Frozen] Mock<IContentVersionCleanupService> cleanupService,
[Frozen] Mock<IContentVersionService> cleanupService,
ContentVersionCleanup sut)
{
settings.Setup(x => x.EnableCleanup).Returns(false);
Expand All @@ -40,7 +40,7 @@ public void ContentVersionCleanup_WhenNotEnabled_DoesNotCleanupWillRepeat(
public void ContentVersionCleanup_RuntimeLevelNotRun_DoesNotCleanupWillRepeat(
[Frozen] Mock<IContentVersionCleanupPolicyGlobalSettings> settings,
[Frozen] Mock<IRuntimeState> state,
[Frozen] Mock<IContentVersionCleanupService> cleanupService,
[Frozen] Mock<IContentVersionService> cleanupService,
ContentVersionCleanup sut)
{
settings.Setup(x => x.EnableCleanup).Returns(true);
Expand All @@ -62,7 +62,7 @@ public void ContentVersionCleanup_RuntimeLevelNotRun_DoesNotCleanupWillRepeat(
public void ContentVersionCleanup_ServerRoleUnknown_DoesNotCleanupWillRepeat(
[Frozen] Mock<IContentVersionCleanupPolicyGlobalSettings> settings,
[Frozen] Mock<IRuntimeState> state,
[Frozen] Mock<IContentVersionCleanupService> cleanupService,
[Frozen] Mock<IContentVersionService> cleanupService,
ContentVersionCleanup sut)
{
settings.Setup(x => x.EnableCleanup).Returns(true);
Expand All @@ -84,7 +84,7 @@ public void ContentVersionCleanup_ServerRoleUnknown_DoesNotCleanupWillRepeat(
public void ContentVersionCleanup_NotMainDom_DoesNotCleanupWillNotRepeat(
[Frozen] Mock<IContentVersionCleanupPolicyGlobalSettings> settings,
[Frozen] Mock<IRuntimeState> state,
[Frozen] Mock<IContentVersionCleanupService> cleanupService,
[Frozen] Mock<IContentVersionService> cleanupService,
ContentVersionCleanup sut)
{
settings.Setup(x => x.EnableCleanup).Returns(true);
Expand All @@ -106,7 +106,7 @@ public void ContentVersionCleanup_NotMainDom_DoesNotCleanupWillNotRepeat(
public void ContentVersionCleanup_Enabled_DelegatesToCleanupService(
[Frozen] Mock<IContentVersionCleanupPolicyGlobalSettings> settings,
[Frozen] Mock<IRuntimeState> state,
[Frozen] Mock<IContentVersionCleanupService> cleanupService,
[Frozen] Mock<IContentVersionService> cleanupService,
ContentVersionCleanup sut)
{
settings.Setup(x => x.EnableCleanup).Returns(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void PerformContentVersionCleanup_WithNoKeepPeriods_DeletesEverythingExce
// Kill all historic
InsertCleanupPolicy(contentTypeA, 0, 0);

((IContentVersionCleanupService)ServiceContext.ContentService).PerformContentVersionCleanup(DateTime.Now.AddHours(1));
((IContentVersionService)ServiceContext.ContentService).PerformContentVersionCleanup(DateTime.Now.AddHours(1));

var after = GetReport();

Expand Down
8 changes: 4 additions & 4 deletions src/Umbraco.Web/Scheduling/ContentVersionCleanup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal class ContentVersionCleanup : RecurringTaskBase
private readonly IRuntimeState _runtimeState;
private readonly IProfilingLogger _logger;
private readonly IContentVersionCleanupPolicyGlobalSettings _settings;
private readonly IContentVersionCleanupService _cleanupService;
private readonly IContentVersionService _service;

public ContentVersionCleanup(
IBackgroundTaskRunner<RecurringTaskBase> runner,
Expand All @@ -21,13 +21,13 @@ public ContentVersionCleanup(
IRuntimeState runtimeState,
IProfilingLogger logger,
IContentVersionCleanupPolicyGlobalSettings settings,
IContentVersionCleanupService cleanupService)
IContentVersionService service)
: base(runner, delayMilliseconds, periodMilliseconds)
{
_runtimeState = runtimeState ?? throw new ArgumentNullException(nameof(runtimeState));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
_cleanupService = cleanupService ?? throw new ArgumentNullException(nameof(cleanupService));
_service = service ?? throw new ArgumentNullException(nameof(service));
}

public override bool PerformRun()
Expand Down Expand Up @@ -65,7 +65,7 @@ public override bool PerformRun()
return false; // do NOT repeat, going down
}

var count = _cleanupService.PerformContentVersionCleanup(DateTime.Now).Count;
var count = _service.PerformContentVersionCleanup(DateTime.Now).Count;

if (count > 0)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Umbraco.Web/Scheduling/SchedulerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public sealed class SchedulerComponent : IComponent

private readonly IRuntimeState _runtime;
private readonly IContentService _contentService;
private readonly IContentVersionCleanupService _cleanupService;
private readonly IContentVersionService _service;
private readonly IAuditService _auditService;
private readonly IProfilingLogger _logger;
private readonly IScopeProvider _scopeProvider;
Expand All @@ -48,7 +48,7 @@ public sealed class SchedulerComponent : IComponent
public SchedulerComponent(
IRuntimeState runtime,
IContentService contentService,
IContentVersionCleanupService cleanupService,
IContentVersionService service,
IAuditService auditService,
HealthCheckCollection healthChecks,
HealthCheckNotificationMethodCollection notifications,
Expand All @@ -58,7 +58,7 @@ public SchedulerComponent(
{
_runtime = runtime;
_contentService = contentService;
_cleanupService = cleanupService;
_service = service;
_auditService = auditService;
_scopeProvider = scopeProvider;
_logger = logger;
Expand Down Expand Up @@ -203,7 +203,7 @@ private IBackgroundTask RegisterContentVersionCleanup(IUmbracoSettingsSection se
_runtime,
_logger,
settings.Content.ContentVersionCleanupPolicyGlobalSettings,
_cleanupService);
_service);

_contentVersionCleanupRunner.TryAdd(task);

Expand Down

0 comments on commit 698e6b1

Please sign in to comment.