fixes installer with async
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core;
|
||||
@@ -75,7 +76,7 @@ namespace Umbraco.Web.Install.Controllers
|
||||
/// <summary>
|
||||
/// Installs.
|
||||
/// </summary>
|
||||
public InstallProgressResultModel PostPerformInstall(InstallInstructions installModel)
|
||||
public async Task<InstallProgressResultModel> PostPerformInstall(InstallInstructions installModel)
|
||||
{
|
||||
if (installModel == null) throw new ArgumentNullException(nameof(installModel));
|
||||
|
||||
@@ -94,8 +95,7 @@ namespace Umbraco.Web.Install.Controllers
|
||||
var step = _installSteps.GetAllSteps().Single(x => x.Name == item.Name);
|
||||
|
||||
// if this step has any instructions then extract them
|
||||
JToken instruction;
|
||||
installModel.Instructions.TryGetValue(item.Name, out instruction); // else null
|
||||
installModel.Instructions.TryGetValue(item.Name, out var instruction); // else null
|
||||
|
||||
// if this step doesn't require execution then continue to the next one, this is just a fail-safe check.
|
||||
if (StepRequiresExecution(step, instruction) == false)
|
||||
@@ -107,7 +107,7 @@ namespace Umbraco.Web.Install.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
var setupData = ExecuteStep(step, instruction);
|
||||
var setupData = await ExecuteStepAsync(step, instruction);
|
||||
|
||||
// update the status
|
||||
InstallStatusTracker.SetComplete(installModel.InstallId, step.Name, setupData?.SavedStepData);
|
||||
@@ -222,7 +222,7 @@ namespace Umbraco.Web.Install.Controllers
|
||||
}
|
||||
|
||||
// executes the step
|
||||
internal InstallSetupResult ExecuteStep(InstallSetupStep step, JToken instruction)
|
||||
internal async Task<InstallSetupResult> ExecuteStepAsync(InstallSetupStep step, JToken instruction)
|
||||
{
|
||||
using (_proflog.TraceDuration<InstallApiController>($"Executing installation step: '{step.Name}'.", "Step completed"))
|
||||
{
|
||||
@@ -232,8 +232,9 @@ namespace Umbraco.Web.Install.Controllers
|
||||
var typedStepType = genericStepType.MakeGenericType(typeArgs);
|
||||
try
|
||||
{
|
||||
var method = typedStepType.GetMethods().Single(x => x.Name == "Execute");
|
||||
return (InstallSetupResult) method.Invoke(step, new[] { model });
|
||||
var method = typedStepType.GetMethods().Single(x => x.Name == "ExecuteAsync");
|
||||
var task = (Task<InstallSetupResult>) method.Invoke(step, new[] { model });
|
||||
return await task;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -82,8 +82,6 @@ namespace Umbraco.Web.Install.Models
|
||||
/// </summary>
|
||||
[IgnoreDataMember]
|
||||
public abstract Type StepType { get; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public bool HasUIElement => View.IsNullOrWhiteSpace() == false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user