Skip to content

Commit a54a76e

Browse files
author
Nikolaj Geisle
committed
Merge branch 'v9/dev' into v9/bugfix/dont-reload-page-with-edit-user-button
# Conflicts: # src/Umbraco.Web.UI.Client/src/views/common/overlays/user/user.html
2 parents 4876108 + 3536863 commit a54a76e

File tree

126 files changed

+8116
-2775
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+8116
-2775
lines changed

build/templates/UmbracoProject/appsettings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"CMS": {
1818
//#if (HasNoNodesViewPath || UseHttpsRedirect)
1919
"Global": {
20+
"SanitizeTinyMce": true,
2021
//#if (!HasNoNodesViewPath && UseHttpsRedirect)
2122
"UseHttps": true
2223
//#elseif (UseHttpsRedirect)
@@ -25,10 +26,16 @@
2526
//#if (HasNoNodesViewPath)
2627
"NoNodesViewPath": "NO_NODES_VIEW_PATH_FROM_TEMPLATE"
2728
//#endif
29+
2830
},
2931
//#endif
3032
"Hosting": {
3133
"Debug": false
34+
},
35+
"Content": {
36+
"ContentVersionCleanupPolicy": {
37+
"EnableCleanup": true
38+
}
3239
}
3340
}
3441
}

src/Umbraco.Core/Collections/StackQueue.cs

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,37 @@
33
namespace Umbraco.Core.Collections
44
{
55
/// <summary>
6-
/// Collection that can be both a queue and a stack.
6+
/// Collection that can be both a queue and a stack.
77
/// </summary>
88
/// <typeparam name="T"></typeparam>
99
public class StackQueue<T>
1010
{
11-
private readonly LinkedList<T> _linkedList = new LinkedList<T>();
11+
private readonly LinkedList<T> _linkedList = new();
1212

13-
public void Clear()
14-
{
15-
_linkedList.Clear();
16-
}
13+
public int Count => _linkedList.Count;
1714

18-
public void Push(T obj)
19-
{
20-
_linkedList.AddFirst(obj);
21-
}
15+
public void Clear() => _linkedList.Clear();
2216

23-
public void Enqueue(T obj)
24-
{
25-
_linkedList.AddFirst(obj);
26-
}
17+
public void Push(T obj) => _linkedList.AddFirst(obj);
18+
19+
public void Enqueue(T obj) => _linkedList.AddFirst(obj);
2720

2821
public T Pop()
2922
{
30-
var obj = _linkedList.First.Value;
23+
T obj = _linkedList.First.Value;
3124
_linkedList.RemoveFirst();
3225
return obj;
3326
}
3427

3528
public T Dequeue()
3629
{
37-
var obj = _linkedList.Last.Value;
30+
T obj = _linkedList.Last.Value;
3831
_linkedList.RemoveLast();
3932
return obj;
4033
}
4134

42-
public T PeekStack()
43-
{
44-
return _linkedList.First.Value;
45-
}
35+
public T PeekStack() => _linkedList.First.Value;
4636

47-
public T PeekQueue()
48-
{
49-
return _linkedList.Last.Value;
50-
}
51-
52-
public int Count
53-
{
54-
get
55-
{
56-
return _linkedList.Count;
57-
}
58-
}
37+
public T PeekQueue() => _linkedList.Last.Value;
5938
}
6039
}

src/Umbraco.Core/Configuration/Models/ContentSettings.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ @keyframes umbraco-preview-badge--effect {{
219219
[DefaultValue(StaticLoginLogoImage)]
220220
public string LoginLogoImage { get; set; } = StaticLoginLogoImage;
221221

222-
222+
/// <summary>
223+
/// Get or sets the model representing the global content version cleanup policy
224+
/// </summary>
225+
public ContentVersionCleanupPolicySettings ContentVersionCleanupPolicy { get; set; } = new ContentVersionCleanupPolicySettings();
223226
}
224227
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.ComponentModel;
2+
3+
namespace Umbraco.Cms.Core.Configuration.Models
4+
{
5+
/// <summary>
6+
/// Model representing the global content version cleanup policy
7+
/// </summary>
8+
public class ContentVersionCleanupPolicySettings
9+
{
10+
private const bool StaticEnableCleanup = false;
11+
private const int StaticKeepAllVersionsNewerThanDays = 7;
12+
private const int StaticKeepLatestVersionPerDayForDays = 90;
13+
14+
/// <summary>
15+
/// Gets or sets a value indicating whether or not the cleanup job should be executed.
16+
/// </summary>
17+
[DefaultValue(StaticEnableCleanup)]
18+
public bool EnableCleanup { get; set; } = StaticEnableCleanup;
19+
20+
/// <summary>
21+
/// Gets or sets the number of days where all historical content versions are kept.
22+
/// </summary>
23+
[DefaultValue(StaticKeepAllVersionsNewerThanDays)]
24+
public int KeepAllVersionsNewerThanDays { get; set; } = StaticKeepAllVersionsNewerThanDays;
25+
26+
/// <summary>
27+
/// Gets or sets the number of days where the latest historical content version for that day are kept.
28+
/// </summary>
29+
[DefaultValue(StaticKeepLatestVersionPerDayForDays)]
30+
public int KeepLatestVersionPerDayForDays { get; set; } = StaticKeepLatestVersionPerDayForDays;
31+
32+
}
33+
}

src/Umbraco.Core/Configuration/Models/GlobalSettings.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class GlobalSettings
2828
internal const bool StaticDisableElectionForSingleServer = false;
2929
internal const string StaticNoNodesViewPath = "~/umbraco/UmbracoWebsite/NoNodes.cshtml";
3030
internal const string StaticSqlWriteLockTimeOut = "00:00:05";
31+
internal const bool StaticSanitizeTinyMce = false;
3132

3233
/// <summary>
3334
/// Gets or sets a value for the reserved URLs.
@@ -157,6 +158,12 @@ public class GlobalSettings
157158
/// </summary>
158159
public bool IsSmtpServerConfigured => !string.IsNullOrWhiteSpace(Smtp?.Host);
159160

161+
/// <summary>
162+
/// Gets a value indicating whether TinyMCE scripting sanitization should be applied
163+
/// </summary>
164+
[DefaultValue(StaticSanitizeTinyMce)]
165+
public bool SanitizeTinyMce => StaticSanitizeTinyMce;
166+
160167
/// <summary>
161168
/// An int value representing the time in milliseconds to lock the database for a write operation
162169
/// </summary>

src/Umbraco.Core/Constants-Sql.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace Umbraco.Cms.Core
2+
{
3+
public static partial class Constants
4+
{
5+
public static class Sql
6+
{
7+
/// <summary>
8+
/// The maximum amount of parameters that can be used in a query.
9+
/// </summary>
10+
/// <remarks>
11+
/// The actual limit is 2100
12+
/// (https://docs.microsoft.com/en-us/sql/sql-server/maximum-capacity-specifications-for-sql-server),
13+
/// but we want to ensure there's room for additional parameters if this value is used to create groups/batches.
14+
/// </remarks>
15+
public const int MaxParameterCount = 2000;
16+
}
17+
}
18+
}

src/Umbraco.Core/HealthChecks/Checks/Security/BaseHttpHeaderCheck.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected async Task<HealthCheckStatus> CheckForHeader()
7979
var success = false;
8080

8181
// Access the site home page and check for the click-jack protection header or meta tag
82-
Uri url = _hostingEnvironment.ApplicationMainUrl;
82+
var url = _hostingEnvironment.ApplicationMainUrl.GetLeftPart(UriPartial.Authority);
8383

8484
try
8585
{

src/Umbraco.Core/Models/ContentEditing/ContentTypeSave.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ protected ContentTypeSave()
2929
[DataMember(Name = "allowedContentTypes")]
3030
public IEnumerable<int> AllowedContentTypes { get; set; }
3131

32+
[DataMember(Name = "historyCleanup")]
33+
public HistoryCleanupViewModel HistoryCleanup { get; set; }
34+
3235
/// <summary>
3336
/// Custom validation
3437
/// </summary>

src/Umbraco.Core/Models/ContentEditing/DocumentTypeDisplay.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Runtime.Serialization;
33

44
namespace Umbraco.Cms.Core.Models.ContentEditing
55
{
66
[DataContract(Name = "contentType", Namespace = "")]
77
public class DocumentTypeDisplay : ContentTypeCompositionDisplay<PropertyTypeDisplay>
88
{
9-
public DocumentTypeDisplay()
10-
{
9+
public DocumentTypeDisplay() =>
1110
//initialize collections so at least their never null
1211
AllowedTemplates = new List<EntityBasic>();
13-
}
1412

1513
//name, alias, icon, thumb, desc, inherited from the content type
1614

@@ -29,5 +27,8 @@ public DocumentTypeDisplay()
2927

3028
[DataMember(Name = "apps")]
3129
public IEnumerable<ContentApp> ContentApps { get; set; }
30+
31+
[DataMember(Name = "historyCleanup")]
32+
public HistoryCleanupViewModel HistoryCleanup { get; set; }
3233
}
3334
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace Umbraco.Cms.Core.Models.ContentEditing
4+
{
5+
[DataContract(Name = "historyCleanup", Namespace = "")]
6+
public class HistoryCleanup
7+
{
8+
[DataMember(Name = "preventCleanup")]
9+
public bool PreventCleanup { get; set; }
10+
11+
[DataMember(Name = "keepAllVersionsNewerThanDays")]
12+
public int? KeepAllVersionsNewerThanDays { get; set; }
13+
14+
[DataMember(Name = "keepLatestVersionPerDayForDays")]
15+
public int? KeepLatestVersionPerDayForDays { get; set; }
16+
}
17+
}

0 commit comments

Comments
 (0)