Removes the runtime PackageMigrations state, the state is just run if unattended migrations are disabled.

This commit is contained in:
Shannon
2021-06-16 13:53:01 -06:00
parent 15f9d675d2
commit 7ec01f232f
5 changed files with 18 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
namespace Umbraco.Cms.Core
namespace Umbraco.Cms.Core
{
/// <summary>
/// Describes the levels in which the runtime can run.
@@ -32,11 +32,6 @@
/// </summary>
Upgrade = 3,
/// <summary>
/// The runtime has detected that Package Migrations need to be executed.
/// </summary>
PackageMigrations = 4,
/// <summary>
/// The runtime has detected an up-to-date Umbraco install and is running.
/// </summary>

View File

@@ -144,9 +144,20 @@ namespace Umbraco.Cms.Infrastructure.Runtime
break;
case UmbracoDatabaseState.NeedsPackageMigration:
_logger.LogDebug("Package migrations need to execute.");
Level = _unattendedSettings.Value.PackageMigrationsUnattended ? RuntimeLevel.Run : RuntimeLevel.PackageMigrations;
Reason = RuntimeLevelReason.UpgradePackageMigrations;
// no matter what the level is run for package migrations.
// they either run unattended, or only manually via the back office.
Level = RuntimeLevel.Run;
if (_unattendedSettings.Value.PackageMigrationsUnattended)
{
_logger.LogDebug("Package migrations need to execute.");
Reason = RuntimeLevelReason.UpgradePackageMigrations;
}
else
{
_logger.LogDebug("Package migrations need to execute but unattended package migrations is disabled. They will need to be run from the back office.");
Reason = RuntimeLevelReason.Run;
}
break;
case UmbracoDatabaseState.Ok:

View File

@@ -60,15 +60,15 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core
}
[Test]
public void GivenPackageMigrationsExist_WhenNotUnattendedMigrations_ThenLevelIsPackageMigrations()
public void GivenPackageMigrationsExist_WhenNotUnattendedMigrations_ThenLevelIsRun()
{
var unattendedOptions = Services.GetRequiredService<IOptions<UnattendedSettings>>();
unattendedOptions.Value.PackageMigrationsUnattended = false;
RuntimeState.DetermineRuntimeLevel();
Assert.AreEqual(RuntimeLevel.PackageMigrations, RuntimeState.Level);
Assert.AreEqual(RuntimeLevelReason.UpgradePackageMigrations, RuntimeState.Reason);
Assert.AreEqual(RuntimeLevel.Run, RuntimeState.Level);
Assert.AreEqual(RuntimeLevelReason.Run, RuntimeState.Reason);
}
private class TestMigrationPlan : PackageMigrationPlan

View File

@@ -48,7 +48,6 @@ namespace Umbraco.Cms.Web.BackOffice.Routing
{
case RuntimeLevel.Install:
case RuntimeLevel.Upgrade:
case RuntimeLevel.PackageMigrations:
case RuntimeLevel.Run:
MapMinimalBackOffice(endpoints);

View File

@@ -36,7 +36,6 @@ namespace Umbraco.Cms.Web.BackOffice.Routing
{
case RuntimeLevel.Install:
case RuntimeLevel.Upgrade:
case RuntimeLevel.PackageMigrations:
case RuntimeLevel.Run:
endpoints.MapHub<PreviewHub>(GetPreviewHubRoute());
endpoints.MapUmbracoRoute<PreviewController>(_umbracoPathSegment, Constants.Web.Mvc.BackOfficeArea, null);