Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v13/dev' into v14/dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	.artifactignore
#	build/azure-pipelines.yml
#	tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker
  • Loading branch information
iOvergaard committed Feb 2, 2024
2 parents 2193ded + 0765a1d commit 52a9939
Show file tree
Hide file tree
Showing 13 changed files with 437 additions and 242 deletions.
4 changes: 2 additions & 2 deletions .artifactignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**/*
!**/bin/**
!**/obj/**
!tests/Umbraco.Tests.Integration/bin/**
!tests/Umbraco.Tests.UnitTests/bin/**
**/node_modules
471 changes: 306 additions & 165 deletions build/azure-pipelines.yml

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"sdk": {
"version": "8.0.0",
"rollForward": "latestFeature",
"allowPrerelease": false
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ protected NestedPropertyIndexValueFactoryBase(
published,
propertyTypeDictionary,
nestedContentRowValue,
availableCultures));
availableCultures,
contentTypeDictionary));

index++;
}
Expand Down Expand Up @@ -213,7 +214,8 @@ private static string GetResumeFromAllContent(List<KeyValuePair<string, IEnumera
bool published,
IDictionary<string, IPropertyType> propertyTypeDictionary,
TItem nestedContentRowValue,
IEnumerable<string> availableCultures)
IEnumerable<string> availableCultures,
IDictionary<Guid,IContentType> contentTypeDictionary)
{
foreach ((var propertyAlias, var propertyValue) in GetRawProperty(nestedContentRowValue))
{
Expand All @@ -238,7 +240,7 @@ private static string GetResumeFromAllContent(List<KeyValuePair<string, IEnumera
subProperty.PublishValues(availableCulture, segment ?? "*");
}
indexValues =
editor.PropertyIndexValueFactory.GetIndexValues(subProperty, availableCulture, segment, published, availableCultures);
editor.PropertyIndexValueFactory.GetIndexValues(subProperty, availableCulture, segment, published, availableCultures, contentTypeDictionary);
}
}
else
Expand All @@ -248,7 +250,7 @@ private static string GetResumeFromAllContent(List<KeyValuePair<string, IEnumera
{
subProperty.PublishValues(culture ?? "*", segment ?? "*");
}
indexValues = editor.PropertyIndexValueFactory.GetIndexValues(subProperty, culture, segment, published, availableCultures);
indexValues = editor.PropertyIndexValueFactory.GetIndexValues(subProperty, culture, segment, published, availableCultures, contentTypeDictionary);
}

foreach ((var nestedAlias, IEnumerable<object?> nestedValue) in indexValues)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ public static class ImageCropperTemplateCoreExtensions
throw new ArgumentNullException(nameof(mediaItem));
}

if (mediaItem.HasProperty(propertyAlias) == false || mediaItem.HasValue(propertyAlias) == false)
if (mediaItem.HasProperty(propertyAlias) == false || mediaItem.HasValue(publishedValueFallback, propertyAlias) == false)
{
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Microsoft.Data.Sqlite;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Extensions;

namespace UmbracoProject;

/// <summary>
/// Ensures a SQLite in-memory database is persisted for the whole application duration.
/// </summary>
public sealed class SQLiteMemoryComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
var connectionString = builder.Config.GetUmbracoConnectionString(out var providerName);
if (!string.IsNullOrEmpty(connectionString) &&
Constants.ProviderNames.SQLLite.InvariantEquals(providerName) &&
connectionString.InvariantContains("Mode=Memory"))
{
// Open new SQLite connection to ensure in-memory database is persisted for the whole application duration
var connection = new SqliteConnection(connectionString);
connection.Open();

// And ensure connection is kept open (by keeping a reference) and gets gracefully closed/disposed when application stops
builder.Services.AddHostedService(_ => new SQLiteMemoryHostedService(connection));
}
}

private sealed class SQLiteMemoryHostedService : IHostedService, IAsyncDisposable
{
private readonly SqliteConnection _connection;

public SQLiteMemoryHostedService(SqliteConnection connection) => _connection = connection;

public Task StartAsync(CancellationToken cancellationToken) => Task.CompletedTask;

public async Task StopAsync(CancellationToken cancellationToken) => await _connection.CloseAsync();

public async ValueTask DisposeAsync() => await _connection.DisposeAsync();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Extensions;

namespace UmbracoProject;

/// <summary>
/// Disable waiting on log IO to finish when commiting a transaction (we can tolerate some data loss) on SQL Server.
/// </summary>
public sealed class SqlServerDelayedDurabilityComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
var connectionString = builder.Config.GetUmbracoConnectionString(out var providerName);
if (!string.IsNullOrEmpty(connectionString) &&
Constants.ProviderNames.SQLServer.InvariantEquals(providerName))
{
builder.AddNotificationAsyncHandler<UnattendedInstallNotification, SqlServerDelayedDurabilityInstallNotification>();
}
}

private sealed class SqlServerDelayedDurabilityInstallNotification : INotificationAsyncHandler<UnattendedInstallNotification>
{
private readonly IOptions<ConnectionStrings> _connectionStrings;

public SqlServerDelayedDurabilityInstallNotification(IOptions<ConnectionStrings> connectionStrings) => _connectionStrings = connectionStrings;

public async Task HandleAsync(UnattendedInstallNotification notification, CancellationToken cancellationToken)
{
using var connection = new SqlConnection(_connectionStrings.Value.ConnectionString);
await connection.OpenAsync(cancellationToken);

// Disable waiting on log IO to finish when commiting a transaction (we can tolerate some data loss)
var command = new SqlCommand("ALTER DATABASE CURRENT SET DELAYED_DURABILITY = FORCED;", connection);
await command.ExecuteNonQueryAsync(cancellationToken);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Infrastructure;

namespace UmbracoProject;

/// <summary>
/// Suspends/disables scheduled publishing, because that takes an eager write lock every minute, resulting in flaky test runs on SQLite.
/// </summary>
public sealed class SuspendScheduledPublishingComposer : IComposer
{
public void Compose(IUmbracoBuilder builder) => Suspendable.ScheduledPublishing.Suspend();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<!-- All C# files in the root of this project will be copied to the E2E/Acceptance Test application during build -->
<OutputType>Library</OutputType>
<RootNamespace>UmbracoProject</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Umbraco.Cms\Umbraco.Cms.csproj" />
</ItemGroup>
</Project>
7 changes: 0 additions & 7 deletions tests/Umbraco.Tests.AcceptanceTest/misc/Directory.Build.props

This file was deleted.

8 changes: 0 additions & 8 deletions tests/Umbraco.Tests.AcceptanceTest/misc/nuget.config

This file was deleted.

51 changes: 0 additions & 51 deletions tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker

This file was deleted.

12 changes: 11 additions & 1 deletion umbraco.sln
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
global.json = global.json
icon.png = icon.png
LICENSE.md = LICENSE.md
umbraco.sln.DotSettings = umbraco.sln.DotSettings
nuget.config = nuget.config
umbraco.sln.DotSettings = umbraco.sln.DotSettings
version.json = version.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{20CE9C97-9314-4A19-BCF1-D12CF49B7205}"
ProjectSection(SolutionItems) = preProject
build\azure-pipelines.yml = build\azure-pipelines.yml
build\nightly-build-trigger.yml = build\nightly-build-trigger.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "csharp-docs", "csharp-docs", "{F2BF84D9-0A14-40AF-A0F3-B9BBBBC16A44}"
Expand Down Expand Up @@ -214,6 +215,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Cms.Persistence.EFC
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Cms.Persistence.EFCore.SqlServer", "src\Umbraco.Cms.Persistence.EFCore.SqlServer\Umbraco.Cms.Persistence.EFCore.SqlServer.csproj", "{9276C3F0-0DC9-46C9-BF32-9EE79D92AE02}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Tests.AcceptanceTest.UmbracoProject", "tests\Umbraco.Tests.AcceptanceTest.UmbracoProject\Umbraco.Tests.AcceptanceTest.UmbracoProject.csproj", "{A13FF0A0-69FA-468A-9F79-565401D5C341}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -408,6 +411,12 @@ Global
{9276C3F0-0DC9-46C9-BF32-9EE79D92AE02}.Release|Any CPU.Build.0 = Release|Any CPU
{9276C3F0-0DC9-46C9-BF32-9EE79D92AE02}.SkipTests|Any CPU.ActiveCfg = Debug|Any CPU
{9276C3F0-0DC9-46C9-BF32-9EE79D92AE02}.SkipTests|Any CPU.Build.0 = Debug|Any CPU
{A13FF0A0-69FA-468A-9F79-565401D5C341}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A13FF0A0-69FA-468A-9F79-565401D5C341}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A13FF0A0-69FA-468A-9F79-565401D5C341}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A13FF0A0-69FA-468A-9F79-565401D5C341}.Release|Any CPU.Build.0 = Release|Any CPU
{A13FF0A0-69FA-468A-9F79-565401D5C341}.SkipTests|Any CPU.ActiveCfg = Debug|Any CPU
{A13FF0A0-69FA-468A-9F79-565401D5C341}.SkipTests|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -429,6 +438,7 @@ Global
{EA628ABD-624E-4AF3-B548-6710D4D66531} = {2B47AD9F-FFF1-448A-88F1-D4F568811738}
{C55CA725-9F4E-4618-9435-6B8AE05DA14D} = {995D9EFA-8BB1-4333-80AD-C525A06FD984}
{D88A926B-E8D6-495A-A2ED-8EFD0C847C62} = {995D9EFA-8BB1-4333-80AD-C525A06FD984}
{A13FF0A0-69FA-468A-9F79-565401D5C341} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7A0F2E34-D2AF-4DAB-86A0-7D7764B3D0EC}
Expand Down

0 comments on commit 52a9939

Please sign in to comment.