Skip to content

Commit 8fd0138

Browse files
committed
Merge remote-tracking branch 'origin/v9/9.1' into v9/dev
2 parents 0286487 + b0a4a92 commit 8fd0138

File tree

38 files changed

+1280
-544
lines changed

38 files changed

+1280
-544
lines changed

build/templates/UmbracoPackage/.template.config/template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"version": {
2525
"type": "parameter",
2626
"datatype": "string",
27-
"defaultValue": "9.2.0-rc",
27+
"defaultValue": "9.1.0",
2828
"description": "The version of Umbraco to load using NuGet",
2929
"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
3030
},

build/templates/UmbracoProject/.template.config/template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"version": {
5858
"type": "parameter",
5959
"datatype": "string",
60-
"defaultValue": "9.2.0-rc",
60+
"defaultValue": "9.1.0",
6161
"description": "The version of Umbraco to load using NuGet",
6262
"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
6363
},

src/Directory.Build.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
44

55
<PropertyGroup>
6-
<Version>9.2.0</Version>
7-
<AssemblyVersion>9.2.0</AssemblyVersion>
8-
<InformationalVersion>9.2.0-rc</InformationalVersion>
9-
<FileVersion>9.2.0</FileVersion>
6+
<Version>9.1.0</Version>
7+
<AssemblyVersion>9.1.0</AssemblyVersion>
8+
<InformationalVersion>9.1.0</InformationalVersion>
9+
<FileVersion>9.1.0</FileVersion>
1010
<LangVersion Condition="'$(LangVersion)' == ''">9.0</LangVersion>
1111
<NeutralLanguage>en-US</NeutralLanguage>
1212
<Company>Umbraco CMS</Company>

src/Umbraco.Core/Models/AuditType.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,16 @@ public enum AuditType
113113
/// <summary>
114114
/// Custom audit message.
115115
/// </summary>
116-
Custom
116+
Custom,
117+
118+
/// <summary>
119+
/// Content version preventCleanup set to true
120+
/// </summary>
121+
ContentVersionPreventCleanup,
122+
123+
/// <summary>
124+
/// Content version preventCleanup set to false
125+
/// </summary>
126+
ContentVersionEnableCleanup
117127
}
118128
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System;
2+
3+
namespace Umbraco.Cms.Core.Models
4+
{
5+
public class ContentVersionMeta
6+
{
7+
public int ContentId { get; }
8+
public int ContentTypeId { get; }
9+
public int VersionId { get; }
10+
public int UserId { get; }
11+
12+
public DateTime VersionDate { get; }
13+
public bool CurrentPublishedVersion { get; }
14+
public bool CurrentDraftVersion { get; }
15+
public bool PreventCleanup { get; }
16+
public string Username { get; }
17+
18+
public ContentVersionMeta() { }
19+
20+
public ContentVersionMeta(
21+
int versionId,
22+
int contentId,
23+
int contentTypeId,
24+
int userId,
25+
DateTime versionDate,
26+
bool currentPublishedVersion,
27+
bool currentDraftVersion,
28+
bool preventCleanup,
29+
string username)
30+
{
31+
VersionId = versionId;
32+
ContentId = contentId;
33+
ContentTypeId = contentTypeId;
34+
35+
UserId = userId;
36+
VersionDate = versionDate;
37+
CurrentPublishedVersion = currentPublishedVersion;
38+
CurrentDraftVersion = currentDraftVersion;
39+
PreventCleanup = preventCleanup;
40+
Username = username;
41+
}
42+
43+
public override string ToString() => $"ContentVersionMeta(versionId: {VersionId}, versionDate: {VersionDate:s}";
44+
}
45+
}

src/Umbraco.Core/Models/HistoricContentVersionMeta.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/Umbraco.Core/Persistence/Repositories/IDocumentVersionRepository.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,31 @@ public interface IDocumentVersionRepository : IRepository
88
/// <summary>
99
/// Gets a list of all historic content versions.
1010
/// </summary>
11-
public IReadOnlyCollection<HistoricContentVersionMeta> GetDocumentVersionsEligibleForCleanup();
11+
public IReadOnlyCollection<ContentVersionMeta> GetDocumentVersionsEligibleForCleanup();
1212

1313
/// <summary>
1414
/// Gets cleanup policy override settings per content type.
1515
/// </summary>
1616
public IReadOnlyCollection<ContentVersionCleanupPolicySettings> GetCleanupPolicies();
1717

18+
/// <summary>
19+
/// Gets paginated content versions for given content id paginated.
20+
/// </summary>
21+
public IEnumerable<ContentVersionMeta> GetPagedItemsByContentId(int contentId, long pageIndex, int pageSize, out long totalRecords, int? languageId = null);
22+
1823
/// <summary>
1924
/// Deletes multiple content versions by ID.
2025
/// </summary>
2126
void DeleteVersions(IEnumerable<int> versionIds);
27+
28+
/// <summary>
29+
/// Updates the prevent cleanup flag on a content version.
30+
/// </summary>
31+
void SetPreventCleanup(int versionId, bool preventCleanup);
32+
33+
/// <summary>
34+
/// Gets the content version metadata for a specific version.
35+
/// </summary>
36+
ContentVersionMeta Get(int versionId);
2237
}
2338
}

src/Umbraco.Core/Services/IContentVersionCleanupPolicy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ public interface IContentVersionCleanupPolicy
1212
/// <summary>
1313
/// Filters a set of candidates historic content versions for cleanup according to policy settings.
1414
/// </summary>
15-
IEnumerable<HistoricContentVersionMeta> Apply(DateTime asAtDate, IEnumerable<HistoricContentVersionMeta> items);
15+
IEnumerable<ContentVersionMeta> Apply(DateTime asAtDate, IEnumerable<ContentVersionMeta> items);
1616
}
1717
}

src/Umbraco.Core/Services/IContentVersionService.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ public interface IContentVersionService
99
/// <summary>
1010
/// Removes historic content versions according to a policy.
1111
/// </summary>
12-
IReadOnlyCollection<HistoricContentVersionMeta> PerformContentVersionCleanup(DateTime asAtDate);
12+
IReadOnlyCollection<ContentVersionMeta> PerformContentVersionCleanup(DateTime asAtDate);
13+
14+
/// <summary>
15+
/// Gets paginated content versions for given content id paginated.
16+
/// </summary>
17+
/// <exception cref="ArgumentException">Thrown when <paramref name="culture"/> is invalid.</exception>
18+
IEnumerable<ContentVersionMeta> GetPagedContentVersions(int contentId, long pageIndex, int pageSize, out long totalRecords, string culture = null);
19+
20+
/// <summary>
21+
/// Updates preventCleanup value for given content version.
22+
/// </summary>
23+
void SetPreventCleanup(int versionId, bool preventCleanup, int userId = -1);
1324
}
1425
}

src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,10 @@ protected override void PersistUpdatedItem(IContent entity)
631631
documentVersionDto.Published = true; // now published
632632
contentVersionDto.Current = false; // no more current
633633
}
634+
635+
// Ensure existing version retains current preventCleanup flag (both saving and publishing).
636+
contentVersionDto.PreventCleanup = version.PreventCleanup;
637+
634638
Database.Update(contentVersionDto);
635639
Database.Update(documentVersionDto);
636640

@@ -642,6 +646,7 @@ protected override void PersistUpdatedItem(IContent entity)
642646
contentVersionDto.Id = 0; // want a new id
643647
contentVersionDto.Current = true; // current version
644648
contentVersionDto.Text = entity.Name;
649+
contentVersionDto.PreventCleanup = false; // new draft version disregards prevent cleanup flag
645650
Database.Insert(contentVersionDto);
646651
entity.VersionId = documentVersionDto.Id = contentVersionDto.Id; // get the new id
647652

0 commit comments

Comments
 (0)