From 10016c74f91dbdf0bc7ad20d5848e8342c408e04 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 14 Jun 2021 14:22:11 -0600 Subject: [PATCH] removes old todos and updates AutomaticPackgeMigrationPlan to use getter with backing field. --- .../Packaging/AutomaticPackgeMigrationPlan.cs | 24 ++++++++++++++----- .../Runtime/RuntimeState.cs | 3 --- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Infrastructure/Packaging/AutomaticPackgeMigrationPlan.cs b/src/Umbraco.Infrastructure/Packaging/AutomaticPackgeMigrationPlan.cs index c509d4f9bc..8377d3dd18 100644 --- a/src/Umbraco.Infrastructure/Packaging/AutomaticPackgeMigrationPlan.cs +++ b/src/Umbraco.Infrastructure/Packaging/AutomaticPackgeMigrationPlan.cs @@ -12,6 +12,8 @@ namespace Umbraco.Cms.Infrastructure.Packaging /// public abstract class AutomaticPackgeMigrationPlan : PackageMigrationPlan { + private XDocument _xdoc; + protected AutomaticPackgeMigrationPlan(string name) : base(name) { @@ -19,18 +21,28 @@ namespace Umbraco.Cms.Infrastructure.Packaging protected sealed override void DefinePlan() { - // calculate the final state based on the hash value of the embedded resource - Type planType = GetType(); - PackageDataManifest = PackageMigrationResource.GetEmbeddedPackageDataManifest(planType); + // calculate the final state based on the hash value of the embedded resource var finalId = PackageDataManifest.ToString(SaveOptions.DisableFormatting).ToGuid(); - To(finalId); } /// - /// Get/set the extracted package data xml manifest + /// Get the extracted package data xml manifest /// - private XDocument PackageDataManifest { get; set; } + private XDocument PackageDataManifest + { + get + { + if (_xdoc != null) + { + return _xdoc; + } + + Type planType = GetType(); + _xdoc = PackageMigrationResource.GetEmbeddedPackageDataManifest(planType); + return _xdoc; + } + } private class MigrateToPackageData : PackageMigrationBase { diff --git a/src/Umbraco.Infrastructure/Runtime/RuntimeState.cs b/src/Umbraco.Infrastructure/Runtime/RuntimeState.cs index 7e8f9e0451..add276760f 100644 --- a/src/Umbraco.Infrastructure/Runtime/RuntimeState.cs +++ b/src/Umbraco.Infrastructure/Runtime/RuntimeState.cs @@ -201,9 +201,6 @@ namespace Umbraco.Cms.Infrastructure.Runtime return UmbracoDatabaseState.NeedsUpgrade; } - // TODO: We will need to scan for implicit migrations. - - // TODO: Can we save the result of this since we'll need to re-use it? IReadOnlyList packagesRequiringMigration = _packageMigrationState.GetUmbracoPendingPackageMigrations(keyValues); if (packagesRequiringMigration.Count > 0) {