From 60644fadc027213dbe802ab451bb2044f1d1c8c9 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 14 Nov 2023 13:27:50 +0100 Subject: [PATCH 01/11] Update global.json --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 17a23f4270..c911052dfd 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "8.0.100-rc.2.23502.2", "rollForward": "latestFeature", "allowPrerelease": true } From 8ffddb77ffe343757e248063feb6bff5860f8090 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 14 Nov 2023 18:55:52 +0100 Subject: [PATCH 02/11] Bump version --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index ca5f5d35d2..1c88857220 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "12.3.2", + "version": "12.3.3", "assemblyVersion": { "precision": "build" }, From d0cd22b09d3e303d84f7155c0f398599bfc8ab06 Mon Sep 17 00:00:00 2001 From: Andreas Zerbst <73799582+andr317c@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:38:18 +0100 Subject: [PATCH 03/11] V12 Bugfix, Added compare provider name extension for Sqlite (#15189) * Created an extension for comparing the current and the outdated providerName for Sqlite * Added usages for the CompareProviderNames * Added another case if the providerName is the outdated SQLite * Both cases use Sqlite, so there is no need to have duplicate code --- .../EfCoreMigrationExecutor.cs | 5 ++--- ...mbracoEFCoreServiceCollectionExtensions.cs | 1 + .../StringExtensions.cs | 21 +++++++++++++++++++ .../UmbracoDbContext.cs | 2 +- 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/Umbraco.Cms.Persistence.EFCore/StringExtensions.cs diff --git a/src/Umbraco.Cms.Persistence.EFCore/EfCoreMigrationExecutor.cs b/src/Umbraco.Cms.Persistence.EFCore/EfCoreMigrationExecutor.cs index 8de8e1f1b8..d50b8b1bf5 100644 --- a/src/Umbraco.Cms.Persistence.EFCore/EfCoreMigrationExecutor.cs +++ b/src/Umbraco.Cms.Persistence.EFCore/EfCoreMigrationExecutor.cs @@ -21,7 +21,7 @@ public class EfCoreMigrationExecutor : IEFCoreMigrationExecutor public async Task ExecuteSingleMigrationAsync(EFCoreMigration migration) { - IMigrationProvider? provider = _migrationProviders.FirstOrDefault(x => x.ProviderName == _options.Value.ProviderName); + IMigrationProvider? provider = _migrationProviders.FirstOrDefault(x => x.ProviderName.CompareProviderNames(_options.Value.ProviderName)); if (provider is not null) { @@ -31,8 +31,7 @@ public class EfCoreMigrationExecutor : IEFCoreMigrationExecutor public async Task ExecuteAllMigrationsAsync() { - IMigrationProvider? provider = _migrationProviders.FirstOrDefault(x => x.ProviderName == _options.Value.ProviderName); - + IMigrationProvider? provider = _migrationProviders.FirstOrDefault(x => x.ProviderName.CompareProviderNames(_options.Value.ProviderName)); if (provider is not null) { await provider.MigrateAllAsync(); diff --git a/src/Umbraco.Cms.Persistence.EFCore/Extensions/UmbracoEFCoreServiceCollectionExtensions.cs b/src/Umbraco.Cms.Persistence.EFCore/Extensions/UmbracoEFCoreServiceCollectionExtensions.cs index d901088064..3d7e01a0ad 100644 --- a/src/Umbraco.Cms.Persistence.EFCore/Extensions/UmbracoEFCoreServiceCollectionExtensions.cs +++ b/src/Umbraco.Cms.Persistence.EFCore/Extensions/UmbracoEFCoreServiceCollectionExtensions.cs @@ -136,6 +136,7 @@ public static class UmbracoEFCoreServiceCollectionExtensions builder.UseSqlServer(connectionString); break; case Constants.ProviderNames.SQLLite: + case "Microsoft.Data.SQLite": builder.UseSqlite(connectionString); break; default: diff --git a/src/Umbraco.Cms.Persistence.EFCore/StringExtensions.cs b/src/Umbraco.Cms.Persistence.EFCore/StringExtensions.cs new file mode 100644 index 0000000000..8b680a08b1 --- /dev/null +++ b/src/Umbraco.Cms.Persistence.EFCore/StringExtensions.cs @@ -0,0 +1,21 @@ +using Umbraco.Cms.Core; + +namespace Umbraco.Cms.Persistence.EFCore; + +internal static class StringExtensions +{ + internal static bool CompareProviderNames(this string connectionProvider, string? compareString) + { + if (compareString is null) + { + return false; + } + + if (connectionProvider == compareString) + { + return true; + } + + return connectionProvider is "Microsoft.Data.SQLite" or Constants.ProviderNames.SQLLite && compareString is "Microsoft.Data.SQLite" or Constants.ProviderNames.SQLLite; + } +} diff --git a/src/Umbraco.Cms.Persistence.EFCore/UmbracoDbContext.cs b/src/Umbraco.Cms.Persistence.EFCore/UmbracoDbContext.cs index 60e519de4c..a27630bd34 100644 --- a/src/Umbraco.Cms.Persistence.EFCore/UmbracoDbContext.cs +++ b/src/Umbraco.Cms.Persistence.EFCore/UmbracoDbContext.cs @@ -58,7 +58,7 @@ public class UmbracoDbContext : DbContext } IEnumerable migrationProviders = StaticServiceProvider.Instance.GetServices(); - IMigrationProviderSetup? migrationProvider = migrationProviders.FirstOrDefault(x => x.ProviderName == connectionStrings.ProviderName); + IMigrationProviderSetup? migrationProvider = migrationProviders.FirstOrDefault(x => x.ProviderName.CompareProviderNames(connectionStrings.ProviderName)); if (migrationProvider == null && connectionStrings.ProviderName != null) { From b8a1c42660498602149088103fb10d097104de80 Mon Sep 17 00:00:00 2001 From: Andreas Zerbst <73799582+andr317c@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:38:18 +0100 Subject: [PATCH 04/11] V12 Bugfix, Added compare provider name extension for Sqlite (#15189) * Created an extension for comparing the current and the outdated providerName for Sqlite * Added usages for the CompareProviderNames * Added another case if the providerName is the outdated SQLite * Both cases use Sqlite, so there is no need to have duplicate code (cherry picked from commit d0cd22b09d3e303d84f7155c0f398599bfc8ab06) --- .../EfCoreMigrationExecutor.cs | 5 ++--- ...mbracoEFCoreServiceCollectionExtensions.cs | 1 + .../StringExtensions.cs | 21 +++++++++++++++++++ .../UmbracoDbContext.cs | 2 +- 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/Umbraco.Cms.Persistence.EFCore/StringExtensions.cs diff --git a/src/Umbraco.Cms.Persistence.EFCore/EfCoreMigrationExecutor.cs b/src/Umbraco.Cms.Persistence.EFCore/EfCoreMigrationExecutor.cs index 8de8e1f1b8..d50b8b1bf5 100644 --- a/src/Umbraco.Cms.Persistence.EFCore/EfCoreMigrationExecutor.cs +++ b/src/Umbraco.Cms.Persistence.EFCore/EfCoreMigrationExecutor.cs @@ -21,7 +21,7 @@ public class EfCoreMigrationExecutor : IEFCoreMigrationExecutor public async Task ExecuteSingleMigrationAsync(EFCoreMigration migration) { - IMigrationProvider? provider = _migrationProviders.FirstOrDefault(x => x.ProviderName == _options.Value.ProviderName); + IMigrationProvider? provider = _migrationProviders.FirstOrDefault(x => x.ProviderName.CompareProviderNames(_options.Value.ProviderName)); if (provider is not null) { @@ -31,8 +31,7 @@ public class EfCoreMigrationExecutor : IEFCoreMigrationExecutor public async Task ExecuteAllMigrationsAsync() { - IMigrationProvider? provider = _migrationProviders.FirstOrDefault(x => x.ProviderName == _options.Value.ProviderName); - + IMigrationProvider? provider = _migrationProviders.FirstOrDefault(x => x.ProviderName.CompareProviderNames(_options.Value.ProviderName)); if (provider is not null) { await provider.MigrateAllAsync(); diff --git a/src/Umbraco.Cms.Persistence.EFCore/Extensions/UmbracoEFCoreServiceCollectionExtensions.cs b/src/Umbraco.Cms.Persistence.EFCore/Extensions/UmbracoEFCoreServiceCollectionExtensions.cs index d901088064..3d7e01a0ad 100644 --- a/src/Umbraco.Cms.Persistence.EFCore/Extensions/UmbracoEFCoreServiceCollectionExtensions.cs +++ b/src/Umbraco.Cms.Persistence.EFCore/Extensions/UmbracoEFCoreServiceCollectionExtensions.cs @@ -136,6 +136,7 @@ public static class UmbracoEFCoreServiceCollectionExtensions builder.UseSqlServer(connectionString); break; case Constants.ProviderNames.SQLLite: + case "Microsoft.Data.SQLite": builder.UseSqlite(connectionString); break; default: diff --git a/src/Umbraco.Cms.Persistence.EFCore/StringExtensions.cs b/src/Umbraco.Cms.Persistence.EFCore/StringExtensions.cs new file mode 100644 index 0000000000..8b680a08b1 --- /dev/null +++ b/src/Umbraco.Cms.Persistence.EFCore/StringExtensions.cs @@ -0,0 +1,21 @@ +using Umbraco.Cms.Core; + +namespace Umbraco.Cms.Persistence.EFCore; + +internal static class StringExtensions +{ + internal static bool CompareProviderNames(this string connectionProvider, string? compareString) + { + if (compareString is null) + { + return false; + } + + if (connectionProvider == compareString) + { + return true; + } + + return connectionProvider is "Microsoft.Data.SQLite" or Constants.ProviderNames.SQLLite && compareString is "Microsoft.Data.SQLite" or Constants.ProviderNames.SQLLite; + } +} diff --git a/src/Umbraco.Cms.Persistence.EFCore/UmbracoDbContext.cs b/src/Umbraco.Cms.Persistence.EFCore/UmbracoDbContext.cs index 60e519de4c..a27630bd34 100644 --- a/src/Umbraco.Cms.Persistence.EFCore/UmbracoDbContext.cs +++ b/src/Umbraco.Cms.Persistence.EFCore/UmbracoDbContext.cs @@ -58,7 +58,7 @@ public class UmbracoDbContext : DbContext } IEnumerable migrationProviders = StaticServiceProvider.Instance.GetServices(); - IMigrationProviderSetup? migrationProvider = migrationProviders.FirstOrDefault(x => x.ProviderName == connectionStrings.ProviderName); + IMigrationProviderSetup? migrationProvider = migrationProviders.FirstOrDefault(x => x.ProviderName.CompareProviderNames(connectionStrings.ProviderName)); if (migrationProvider == null && connectionStrings.ProviderName != null) { From c7e5d94f455449246d23c1fc26d76827e4e35173 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Wed, 15 Nov 2023 08:39:01 +0100 Subject: [PATCH 05/11] Dynamic root feature translations (Dutch) (#15109) * Fix typo * Add Dutch translations --- src/Umbraco.Core/EmbeddedResources/Lang/en.xml | 2 +- src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml | 2 +- src/Umbraco.Core/EmbeddedResources/Lang/nl.xml | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/EmbeddedResources/Lang/en.xml b/src/Umbraco.Core/EmbeddedResources/Lang/en.xml index e6662d6201..3c7bb7b5ca 100644 --- a/src/Umbraco.Core/EmbeddedResources/Lang/en.xml +++ b/src/Umbraco.Core/EmbeddedResources/Lang/en.xml @@ -1467,7 +1467,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Add query step That matches types: No matching content - The configuration of this property does not match any content. Create the missing content or contact your adminnistrator to adjust the Dynamic Root settings for this property. + The configuration of this property does not match any content. Create the missing content or contact your administrator to adjust the Dynamic Root settings for this property. Deleted item diff --git a/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml b/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml index 0602ff487a..ed1b923d66 100644 --- a/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml +++ b/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml @@ -1507,7 +1507,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Add query step That matches types: No matching content - The configuration of this property does not match any content. Create the missing content or contact your adminnistrator to adjust the Dynamic Root settings for this property. + The configuration of this property does not match any content. Create the missing content or contact your administrator to adjust the Dynamic Root settings for this property. Deleted item diff --git a/src/Umbraco.Core/EmbeddedResources/Lang/nl.xml b/src/Umbraco.Core/EmbeddedResources/Lang/nl.xml index 5681236051..600a1724c1 100644 --- a/src/Umbraco.Core/EmbeddedResources/Lang/nl.xml +++ b/src/Umbraco.Core/EmbeddedResources/Lang/nl.xml @@ -1235,6 +1235,10 @@ Echter, Runway biedt een gemakkelijke basis om je snel op weg te helpen. Als je prullenbak zijn + + Geen overeenkomende inhoud + De configuratie van deze eigenschap komt met geen enkele inhoud overeen. Maak de ontbrekende inhoud aan of neem contact op met uw beheerder om de dynamische root-instellingen voor deze eigenschap aan te passen. + Verwijderd item Je hebt een media-item geselecteerd dat op dit ogenblik verwijderd of in the From 28e8ac11f0c37f7f5b8fbd729c33642e2029928e Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 15 Nov 2023 09:03:08 +0100 Subject: [PATCH 06/11] Added scope.complete in edge cases. (#15207) --- src/Umbraco.Core/Services/ContentVersionService.cs | 2 ++ src/Umbraco.Web.Website/Controllers/UmbProfileController.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Umbraco.Core/Services/ContentVersionService.cs b/src/Umbraco.Core/Services/ContentVersionService.cs index 1c190311da..3d3eed062e 100644 --- a/src/Umbraco.Core/Services/ContentVersionService.cs +++ b/src/Umbraco.Core/Services/ContentVersionService.cs @@ -77,6 +77,7 @@ internal class ContentVersionService : IContentVersionService if (version is null) { + scope.Complete(); return; } @@ -128,6 +129,7 @@ internal class ContentVersionService : IContentVersionService if (allHistoricVersions is null) { + scope.Complete(); return Array.Empty(); } if (_logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) diff --git a/src/Umbraco.Web.Website/Controllers/UmbProfileController.cs b/src/Umbraco.Web.Website/Controllers/UmbProfileController.cs index 22d5f7e3e2..d493bb7e02 100644 --- a/src/Umbraco.Web.Website/Controllers/UmbProfileController.cs +++ b/src/Umbraco.Web.Website/Controllers/UmbProfileController.cs @@ -112,6 +112,7 @@ public class UmbProfileController : SurfaceController IdentityResult saveResult = await _memberManager.UpdateAsync(currentMember); if (!saveResult.Succeeded) { + scope.Complete(); return saveResult; } From 65b7967fedb78b6df8f8dd331ad5c48405c89628 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 15 Nov 2023 09:29:50 +0100 Subject: [PATCH 07/11] Updated to .NET 8 final (#15204) --- global.json | 4 ++-- ...co.Cms.Persistence.EFCore.SqlServer.csproj | 2 +- ...braco.Cms.Persistence.EFCore.Sqlite.csproj | 2 +- .../Umbraco.Cms.Persistence.EFCore.csproj | 6 ++--- .../Umbraco.Cms.Persistence.Sqlite.csproj | 2 +- src/Umbraco.Core/Umbraco.Core.csproj | 22 +++++++++---------- .../Umbraco.Infrastructure.csproj | 14 ++++++------ .../Umbraco.Web.Common.csproj | 4 ++-- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 +- .../Umbraco.Tests.Benchmarks.csproj | 4 ++-- .../Umbraco.Tests.Integration.csproj | 2 +- .../Umbraco.Tests.UnitTests.csproj | 4 ++-- 12 files changed, 34 insertions(+), 34 deletions(-) diff --git a/global.json b/global.json index c911052dfd..4c4c3ae5ed 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "8.0.100-rc.2.23502.2", + "version": "8.0.100", "rollForward": "latestFeature", - "allowPrerelease": true + "allowPrerelease": false } } diff --git a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj index 04e711f8d9..baab56e96e 100644 --- a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj +++ b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj index 92eb79375f..84e88c3523 100644 --- a/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj +++ b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj b/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj index 3282f2622d..d2c8c64405 100644 --- a/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj +++ b/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj @@ -5,9 +5,9 @@ - - - + + + diff --git a/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj b/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj index 645e42d666..b49b4eebee 100644 --- a/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj +++ b/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 83491bbe6c..7a45a2ea14 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -7,22 +7,22 @@ - - - - - - - - - - + + + + + + + + + + - + diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index 58c02da503..76c04063a7 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -16,11 +16,11 @@ - - - - - + + + + + @@ -39,8 +39,8 @@ - - + + diff --git a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj index dc0d0dc6fa..fc9f37b725 100644 --- a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj +++ b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 347238afda..76f2f57e3b 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -10,7 +10,7 @@ - + diff --git a/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj b/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj index 342622c094..885fc01b0e 100644 --- a/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj +++ b/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj @@ -4,8 +4,8 @@ - - + + diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj b/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj index 3d79aa6295..44801a1011 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj +++ b/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj @@ -11,7 +11,7 @@ - + diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj index 8432428bab..30616ec926 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj @@ -8,8 +8,8 @@ - - + + From d2ff2ea46ea00a8082b77d533a8f45d15bf212cb Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 15 Nov 2023 09:34:27 +0100 Subject: [PATCH 08/11] Bugfix: Count existing media correct (#15206) * https://github.com/umbraco/Umbraco-CMS/issues/15205 Count media correct * Fix content should be document --- .../Persistence/NuCacheContentRepository.cs | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.PublishedCache.NuCache/Persistence/NuCacheContentRepository.cs b/src/Umbraco.PublishedCache.NuCache/Persistence/NuCacheContentRepository.cs index f54158dac1..f76b176d5e 100644 --- a/src/Umbraco.PublishedCache.NuCache/Persistence/NuCacheContentRepository.cs +++ b/src/Umbraco.PublishedCache.NuCache/Persistence/NuCacheContentRepository.cs @@ -224,7 +224,7 @@ AND cmsContentNu.nodeId IS NULL IContentCacheDataSerializer serializer = _contentCacheDataSerializerFactory.Create(ContentCacheDataSerializerEntityType.Document); - IEnumerable dtos = GetContentNodeDtos(sql, Constants.ObjectTypes.Document); + IEnumerable dtos = GetContentNodeDtos(sql); foreach (ContentSourceDto row in dtos) { @@ -242,7 +242,7 @@ AND cmsContentNu.nodeId IS NULL IContentCacheDataSerializer serializer = _contentCacheDataSerializerFactory.Create(ContentCacheDataSerializerEntityType.Document); - IEnumerable dtos = GetContentNodeDtos(sql, Constants.ObjectTypes.Document); + IEnumerable dtos = GetContentNodeDtos(sql); foreach (ContentSourceDto row in dtos) { @@ -265,7 +265,7 @@ AND cmsContentNu.nodeId IS NULL IContentCacheDataSerializer serializer = _contentCacheDataSerializerFactory.Create(ContentCacheDataSerializerEntityType.Document); - IEnumerable dtos = GetContentNodeDtos(sql, Constants.ObjectTypes.Document); + IEnumerable dtos = GetContentNodeDtos(sql); foreach (ContentSourceDto row in dtos) { @@ -301,7 +301,7 @@ AND cmsContentNu.nodeId IS NULL IContentCacheDataSerializer serializer = _contentCacheDataSerializerFactory.Create(ContentCacheDataSerializerEntityType.Media); - IEnumerable dtos = GetContentNodeDtos(sql, Constants.ObjectTypes.Media); + IEnumerable dtos = GetMediaNodeDtos(sql); foreach (ContentSourceDto row in dtos) { @@ -319,7 +319,7 @@ AND cmsContentNu.nodeId IS NULL IContentCacheDataSerializer serializer = _contentCacheDataSerializerFactory.Create(ContentCacheDataSerializerEntityType.Media); - IEnumerable dtos = GetContentNodeDtos(sql, Constants.ObjectTypes.Media); + IEnumerable dtos = GetMediaNodeDtos(sql); foreach (ContentSourceDto row in dtos) { @@ -342,7 +342,7 @@ AND cmsContentNu.nodeId IS NULL IContentCacheDataSerializer serializer = _contentCacheDataSerializerFactory.Create(ContentCacheDataSerializerEntityType.Media); - IEnumerable dtos = GetContentNodeDtos(sql, Constants.ObjectTypes.Media); + IEnumerable dtos = GetMediaNodeDtos(sql); foreach (ContentSourceDto row in dtos) { @@ -990,7 +990,32 @@ WHERE cmsContentNu.nodeId IN ( return s; } - private IEnumerable GetContentNodeDtos(Sql sql, Guid nodeObjectType) + private IEnumerable GetMediaNodeDtos(Sql sql) + { + // We need to page here. We don't want to iterate over every single row in one connection cuz this can cause an SQL Timeout. + // We also want to read with a db reader and not load everything into memory, QueryPaged lets us do that. + // QueryPaged is very slow on large sites however, so use fetch if UsePagedSqlQuery is disabled. + IEnumerable dtos; + if (_nucacheSettings.Value.UsePagedSqlQuery) + { + // Use a more efficient COUNT query + Sql? sqlCountQuery = SqlMediaSourcesCount() + .Append(SqlObjectTypeNotTrashed(SqlContext, Constants.ObjectTypes.Media)); + + Sql? sqlCount = + SqlContext.Sql("SELECT COUNT(*) FROM (").Append(sqlCountQuery).Append(") npoco_tbl"); + + dtos = Database.QueryPaged(_nucacheSettings.Value.SqlPageSize, sql, sqlCount); + } + else + { + dtos = Database.Fetch(sql); + } + + return dtos; + } + + private IEnumerable GetContentNodeDtos(Sql sql) { // We need to page here. We don't want to iterate over every single row in one connection cuz this can cause an SQL Timeout. // We also want to read with a db reader and not load everything into memory, QueryPaged lets us do that. @@ -1000,7 +1025,7 @@ WHERE cmsContentNu.nodeId IN ( { // Use a more efficient COUNT query Sql? sqlCountQuery = SqlContentSourcesCount() - .Append(SqlObjectTypeNotTrashed(SqlContext, nodeObjectType)); + .Append(SqlObjectTypeNotTrashed(SqlContext, Constants.ObjectTypes.Document)); Sql? sqlCount = SqlContext.Sql("SELECT COUNT(*) FROM (").Append(sqlCountQuery).Append(") npoco_tbl"); From 73eb9e04da44089f0029b2318f87c168c5a7fa34 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 15 Nov 2023 12:05:09 +0100 Subject: [PATCH 09/11] bump version --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 01fadfd808..9a77786a0f 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "13.0.0-rc2", + "version": "13.0.0-rc3", "assemblyVersion": { "precision": "build" }, From ab2ebba6908157cf02e8982fc61dfb5122b9d97f Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 15 Nov 2023 12:05:19 +0100 Subject: [PATCH 10/11] remove imagesharp reference --- src/Umbraco.Web.Common/Umbraco.Web.Common.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj index fc9f37b725..5688c37c5b 100644 --- a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj +++ b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj @@ -14,7 +14,6 @@ - From ead7741ee2397541719b613750c920272df8d586 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Thu, 16 Nov 2023 06:33:36 +0100 Subject: [PATCH 11/11] Updated rich text parser interfaces to support context cache. (#15220) --- src/Umbraco.Core/Deploy/IImageSourceParser.cs | 25 ++++++++++++ src/Umbraco.Core/Deploy/ILocalLinkParser.cs | 28 ++++++++++++++ src/Umbraco.Core/Deploy/IMacroParser.cs | 38 +++++++++++++++++++ 3 files changed, 91 insertions(+) diff --git a/src/Umbraco.Core/Deploy/IImageSourceParser.cs b/src/Umbraco.Core/Deploy/IImageSourceParser.cs index 0180ec0b3d..cbbaa6bc9a 100644 --- a/src/Umbraco.Core/Deploy/IImageSourceParser.cs +++ b/src/Umbraco.Core/Deploy/IImageSourceParser.cs @@ -12,13 +12,38 @@ public interface IImageSourceParser /// A list of dependencies. /// The parsed value. /// Turns src="/media/..." into src="umb://media/..." and adds the corresponding udi to the dependencies. + [Obsolete("Please use the overload taking all parameters. This method will be removed in Umbraco 14.")] string ToArtifact(string value, ICollection dependencies); + /// + /// Parses an Umbraco property value and produces an artifact property value. + /// + /// The property value. + /// A list of dependencies. + /// The context cache. + /// The parsed value. + /// Turns src="/media/..." into src="umb://media/..." and adds the corresponding udi to the dependencies. +#pragma warning disable CS0618 // Type or member is obsolete + string ToArtifact(string value, ICollection dependencies, IContextCache contextCache) => ToArtifact(value, dependencies); +#pragma warning restore CS0618 // Type or member is obsolete + /// /// Parses an artifact property value and produces an Umbraco property value. /// /// The artifact property value. /// The parsed value. /// Turns umb://media/... into /media/.... + [Obsolete("Please use the overload taking all parameters. This method will be removed in Umbraco 14.")] string FromArtifact(string value); + + /// + /// Parses an artifact property value and produces an Umbraco property value. + /// + /// The artifact property value. + /// The context cache. + /// The parsed value. + /// Turns umb://media/... into /media/.... +#pragma warning disable CS0618 // Type or member is obsolete + string FromArtifact(string value, IContextCache contextCache) => FromArtifact(value); +#pragma warning restore CS0618 // Type or member is obsolete } diff --git a/src/Umbraco.Core/Deploy/ILocalLinkParser.cs b/src/Umbraco.Core/Deploy/ILocalLinkParser.cs index 7ec3fff0fa..d84bf35af1 100644 --- a/src/Umbraco.Core/Deploy/ILocalLinkParser.cs +++ b/src/Umbraco.Core/Deploy/ILocalLinkParser.cs @@ -15,13 +15,41 @@ public interface ILocalLinkParser /// Turns {{localLink:1234}} into {{localLink:umb://{type}/{id}}} and adds the corresponding udi to the /// dependencies. /// + [Obsolete("Please use the overload taking all parameters. This method will be removed in Umbraco 14.")] string ToArtifact(string value, ICollection dependencies); + /// + /// Parses an Umbraco property value and produces an artifact property value. + /// + /// The property value. + /// A list of dependencies. + /// The context cache. + /// The parsed value. + /// + /// Turns {{localLink:1234}} into {{localLink:umb://{type}/{id}}} and adds the corresponding udi to the + /// dependencies. + /// +#pragma warning disable CS0618 // Type or member is obsolete + string ToArtifact(string value, ICollection dependencies, IContextCache contextCache) => ToArtifact(value, dependencies); +#pragma warning restore CS0618 // Type or member is obsolete + /// /// Parses an artifact property value and produces an Umbraco property value. /// /// The artifact property value. /// The parsed value. /// Turns {{localLink:umb://{type}/{id}}} into {{localLink:1234}}. + [Obsolete("Please use the overload taking all parameters. This method will be removed in Umbraco 14.")] string FromArtifact(string value); + + /// + /// Parses an artifact property value and produces an Umbraco property value. + /// + /// The artifact property value. + /// The context cache. + /// The parsed value. + /// Turns {{localLink:umb://{type}/{id}}} into {{localLink:1234}}. +#pragma warning disable CS0618 // Type or member is obsolete + string FromArtifact(string value, IContextCache contextCache) => FromArtifact(value); +#pragma warning restore CS0618 // Type or member is obsolete } diff --git a/src/Umbraco.Core/Deploy/IMacroParser.cs b/src/Umbraco.Core/Deploy/IMacroParser.cs index fed9dcc3af..17f06992d5 100644 --- a/src/Umbraco.Core/Deploy/IMacroParser.cs +++ b/src/Umbraco.Core/Deploy/IMacroParser.cs @@ -8,15 +8,38 @@ public interface IMacroParser /// Property value. /// A list of dependencies. /// Parsed value. + [Obsolete("Please use the overload taking all parameters. This method will be removed in Umbraco 14.")] string ToArtifact(string value, ICollection dependencies); + /// + /// Parses an Umbraco property value and produces an artifact property value. + /// + /// Property value. + /// A list of dependencies. + /// The context cache. + /// Parsed value. +#pragma warning disable CS0618 // Type or member is obsolete + string ToArtifact(string value, ICollection dependencies, IContextCache contextCache) => ToArtifact(value, dependencies); +#pragma warning restore CS0618 // Type or member is obsolete + /// /// Parses an artifact property value and produces an Umbraco property value. /// /// Artifact property value. /// Parsed value. + [Obsolete("Please use the overload taking all parameters. This method will be removed in Umbraco 14.")] string FromArtifact(string value); + /// + /// Parses an artifact property value and produces an Umbraco property value. + /// + /// Artifact property value. + /// The context cache. + /// Parsed value. +#pragma warning disable CS0618 // Type or member is obsolete + string FromArtifact(string value, IContextCache contextCache) => FromArtifact(value); +#pragma warning restore CS0618 // Type or member is obsolete + /// /// Tries to replace the value of the attribute/parameter with a value containing a converted identifier. /// @@ -25,5 +48,20 @@ public interface IMacroParser /// Collection to add dependencies to when performing ToArtifact /// Indicates which action is being performed (to or from artifact) /// Value with converted identifiers + [Obsolete("Please use the overload taking all parameters. This method will be removed in Umbraco 14.")] string ReplaceAttributeValue(string value, string editorAlias, ICollection dependencies, Direction direction); + + /// + /// Tries to replace the value of the attribute/parameter with a value containing a converted identifier. + /// + /// Value to attempt to convert + /// Alias of the editor used for the parameter + /// Collection to add dependencies to when performing ToArtifact + /// Indicates which action is being performed (to or from artifact) + /// The context cache. + /// Value with converted identifiers + string ReplaceAttributeValue(string value, string editorAlias, ICollection dependencies, Direction direction, IContextCache contextCache) +#pragma warning disable CS0618 // Type or member is obsolete + => ReplaceAttributeValue(value, editorAlias, dependencies, direction); +#pragma warning restore CS0618 // Type or member is obsolete }