mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-21 19:34:40 +08:00
Modifying ISetupService::Setup to return an executionId.
--HG-- branch : recipe
This commit is contained in:
@@ -105,7 +105,7 @@ namespace Orchard.Setup.Controllers {
|
||||
Recipe = model.Recipe
|
||||
};
|
||||
|
||||
_setupService.Setup(setupContext);
|
||||
string executionId = _setupService.Setup(setupContext);
|
||||
|
||||
// First time installation if finally done. Tell the background views compilation
|
||||
// process to stop, so that it doesn't interfere with the user (asp.net compilation
|
||||
|
@@ -6,6 +6,6 @@ namespace Orchard.Setup.Services {
|
||||
public interface ISetupService : IDependency {
|
||||
ShellSettings Prime();
|
||||
IEnumerable<Recipe> Recipes();
|
||||
void Setup(SetupContext context);
|
||||
string Setup(SetupContext context);
|
||||
}
|
||||
}
|
@@ -72,7 +72,8 @@ namespace Orchard.Setup.Services {
|
||||
return _recipes;
|
||||
}
|
||||
|
||||
public void Setup(SetupContext context) {
|
||||
public string Setup(SetupContext context) {
|
||||
string executionId = null;
|
||||
// The vanilla Orchard distibution has the following features enabled.
|
||||
if (context.EnabledFeatures == null || context.EnabledFeatures.Count() == 0) {
|
||||
string[] hardcoded = {
|
||||
@@ -200,7 +201,7 @@ namespace Orchard.Setup.Services {
|
||||
shellSettings.State = new TenantState("Running");
|
||||
using (var environment = _orchardHost.CreateStandaloneEnvironment(shellSettings)) {
|
||||
try {
|
||||
CreateTenantData(context, environment);
|
||||
executionId = CreateTenantData(context, environment);
|
||||
}
|
||||
catch {
|
||||
environment.Resolve<ITransactionManager>().Cancel();
|
||||
@@ -209,9 +210,12 @@ namespace Orchard.Setup.Services {
|
||||
}
|
||||
|
||||
_shellSettingsManager.SaveSettings(shellSettings);
|
||||
|
||||
return executionId;
|
||||
}
|
||||
|
||||
private void CreateTenantData(SetupContext context, IWorkContextScope environment) {
|
||||
private string CreateTenantData(SetupContext context, IWorkContextScope environment) {
|
||||
string executionId = null;
|
||||
// create superuser
|
||||
var membershipService = environment.Resolve<IMembershipService>();
|
||||
var user =
|
||||
@@ -242,7 +246,7 @@ namespace Orchard.Setup.Services {
|
||||
|
||||
var recipeManager = environment.Resolve<IRecipeManager>();
|
||||
if (context.Recipe != null) {
|
||||
recipeManager.Execute(Recipes().Where(r => r.Name == context.Recipe).FirstOrDefault());
|
||||
executionId = recipeManager.Execute(Recipes().Where(r => r.Name == context.Recipe).FirstOrDefault());
|
||||
}
|
||||
|
||||
var contentManager = environment.Resolve<IContentManager>();
|
||||
@@ -325,6 +329,8 @@ Modules are created by other users of Orchard just like you so if you feel up to
|
||||
if (HttpContext.Current != null) {
|
||||
authenticationService.SignIn(user, true);
|
||||
}
|
||||
|
||||
return executionId;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user