Skip to content

Commit

Permalink
Merge pull request #69 from umbraco/v15/task/upgrade-from-14
Browse files Browse the repository at this point in the history
V15: Initial upgrade from 14
  • Loading branch information
ronaldbarendse authored Oct 14, 2024
2 parents 6901ba6 + df822b5 commit aa2303f
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 254 deletions.
7 changes: 4 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Company>Umbraco HQ</Company>
<Authors>Umbraco</Authors>
<Copyright>Copyright © Umbraco $([System.DateTime]::Today.ToString('yyyy'))</Copyright>
Expand All @@ -27,8 +27,9 @@
<!-- Package Validation -->
<PropertyGroup>
<GenerateCompatibilitySuppressionFile>false</GenerateCompatibilitySuppressionFile>
<EnablePackageValidation>true</EnablePackageValidation>
<PackageValidationBaselineVersion>14.0.0</PackageValidationBaselineVersion>
<!-- TODO (V15): Re-enable when 15.0.0 is released. -->
<EnablePackageValidation>false</EnablePackageValidation>
<PackageValidationBaselineVersion>15.0.0</PackageValidationBaselineVersion>
<EnableStrictModeForCompatibleFrameworksInPackage>true</EnableStrictModeForCompatibleFrameworksInPackage>
<EnableStrictModeForCompatibleTfms>true</EnableStrictModeForCompatibleTfms>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
</PropertyGroup>
<!-- Global packages (private, build-time packages for all projects) -->
<ItemGroup>
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.143" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<GlobalPackageReference Include="Umbraco.Code" Version="2.1.0" />
<GlobalPackageReference Include="Umbraco.Code" Version="2.2.0" />
<GlobalPackageReference Include="Umbraco.GitVersioning.Extensions" Version="0.2.0" />
</ItemGroup>
<!-- Umbraco packages -->
<ItemGroup>
<PackageVersion Include="Umbraco.Cms.Web.Common" Version="[14.0.0, 15)" />
<PackageVersion Include="Umbraco.Deploy.Infrastructure" Version="[14.1.0, 15)" />
<PackageVersion Include="Umbraco.Cms.Web.Common" Version="[15.0.0-rc1, 16)" />
<PackageVersion Include="Umbraco.Deploy.Infrastructure" Version="[15.0.0-rc1, 16)" />
</ItemGroup>
</Project>
7 changes: 4 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"sdk": {
"version": "8.0.100",
"rollForward": "latestFeature"
"version": "9.0.100-rc.1.24452.12",
"rollForward": "latestFeature",
"allowPrerelease": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Umbraco.Cms.Core;
Expand Down Expand Up @@ -40,14 +42,14 @@ public DocTypeGridEditorPropertyTypeMigrator(ILogger<GridPropertyTypeMigrator> l
=> _jsonSerializer = jsonSerializer;

/// <inheritdoc />
protected override BlockItemData? MigrateGridControl(GridValue.GridControl gridControl, BlockGridConfiguration configuration, IContextCache contextCache)
protected override async Task<BlockItemData?> MigrateGridControlAsync(GridValue.GridControl gridControl, BlockGridConfiguration configuration, IContextCache contextCache, CancellationToken cancellationToken = default)
{
if (TryDeserialize(gridControl.Value, out DocTypeGridEditorValue? value))
{
return MigrateGridControl(value, configuration, contextCache);
return await MigrateGridControlAsync(value, configuration, contextCache).ConfigureAwait(false);
}

return base.MigrateGridControl(gridControl, configuration, contextCache);
return await base.MigrateGridControlAsync(gridControl, configuration, contextCache, cancellationToken).ConfigureAwait(false);
}

/// <summary>
Expand All @@ -57,11 +59,11 @@ public DocTypeGridEditorPropertyTypeMigrator(ILogger<GridPropertyTypeMigrator> l
/// <param name="configuration">The configuration.</param>
/// <param name="contextCache">The context cache.</param>
/// <returns>
/// The block item data, or <c>null</c> if migration should be skipped.
/// A task that represents the asynchronous operation. The task result contains the block item data, or <c>null</c> if migration should be skipped.
/// </returns>
protected virtual BlockItemData? MigrateGridControl(DocTypeGridEditorValue value, BlockGridConfiguration configuration, IContextCache contextCache)
protected virtual async Task<BlockItemData?> MigrateGridControlAsync(DocTypeGridEditorValue value, BlockGridConfiguration configuration, IContextCache contextCache)
{
IContentType contentType = GetContentType(value.ContentTypeAlias, configuration, contextCache)
IContentType contentType = await GetContentTypeAsync(value.ContentTypeAlias, configuration, contextCache).ConfigureAwait(false)
?? throw new InvalidOperationException($"Migrating legacy grid failed, because content type with alias '{value.ContentTypeAlias}' could not be found (in the Block Grid configuration).");

return new BlockItemData()
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Umbraco.Cms.Core.Deploy;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Serialization;
Expand All @@ -8,7 +10,7 @@
namespace Umbraco.Deploy.Contrib.Migrators.Legacy;

/// <summary>
/// Migrates the property value containing prevalues (seperated by <see cref="Delimiter" />) from Umbraco 7 to a single value or JSON array.
/// Migrates the property value containing pre-values (separated by <see cref="Delimiter" />) from Umbraco 7 to a single value or JSON array.
/// </summary>
public abstract class PrevaluePropertyTypeMigratorBase : PropertyTypeMigratorBase
{
Expand All @@ -18,10 +20,10 @@ public abstract class PrevaluePropertyTypeMigratorBase : PropertyTypeMigratorBas
private readonly IJsonSerializer _jsonSerializer;

/// <summary>
/// Gets a value indicating whether the property type stores multiple prevalues as a JSON array or single value.
/// Gets a value indicating whether the property type stores multiple pre-values as a JSON array or single value.
/// </summary>
/// <value>
/// <c>true</c> if multiple prevalues are stored as a JSON array; otherwise, <c>false</c>.
/// <c>true</c> if multiple pre-values are stored as a JSON array; otherwise, <c>false</c>.
/// </value>
protected abstract bool Multiple { get; }

Expand All @@ -45,7 +47,10 @@ protected PrevaluePropertyTypeMigratorBase(string fromEditorAlias, string toEdit
=> _jsonSerializer = jsonSerializer;

/// <inheritdoc />
public override object? Migrate(IPropertyType propertyType, object? value, IDictionary<string, string> propertyEditorAliases, IContextCache contextCache)
public override Task<object?> MigrateAsync(IPropertyType propertyType, object? value, IDictionary<string, string> propertyEditorAliases, IContextCache contextCache, CancellationToken cancellationToken = default)
=> Task.FromResult(Migrate(propertyType));

private object? Migrate(object? value)
{
if (value is not string stringValue)
{
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Cms.Core.Semver;
using Umbraco.Cms.Core.Serialization;
Expand All @@ -23,21 +20,6 @@ public class MultiNodeTreePicker2DataTypeArtifactMigrator : LegacyReplaceDataTyp
private readonly IMediaTypeService _mediaTypeService;
private readonly IMemberTypeService _memberTypeService;

/// <summary>
/// Initializes a new instance of the <see cref="MultiNodeTreePicker2DataTypeArtifactMigrator" /> class.
/// </summary>
/// <param name="propertyEditors">The property editors.</param>
/// <param name="configurationEditorJsonSerializer">The configuration editor JSON serializer.</param>
[Obsolete("Please use the constructor taking all parameters. This constructor will be removed in a future version.")]
public MultiNodeTreePicker2DataTypeArtifactMigrator(PropertyEditorCollection propertyEditors, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer)
: this(
propertyEditors,
configurationEditorJsonSerializer,
StaticServiceProvider.Instance.GetRequiredService<IContentTypeService>(),
StaticServiceProvider.Instance.GetRequiredService<IMediaTypeService>(),
StaticServiceProvider.Instance.GetRequiredService<IMemberTypeService>())
{ }

/// <summary>
/// Initializes a new instance of the <see cref="MultiNodeTreePicker2DataTypeArtifactMigrator" /> class.
/// </summary>
Expand Down

This file was deleted.

Loading

0 comments on commit aa2303f

Please sign in to comment.