Skip to content

Commit 1a58295

Browse files
committed
Fixed installation issues
1 parent 5c03950 commit 1a58295

File tree

5 files changed

+33
-32
lines changed

5 files changed

+33
-32
lines changed

src/Presentation/SmartStore.Web.Framework/DependencyRegistrar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ protected override void Load(ContainerBuilder builder)
415415
}
416416
catch
417417
{
418-
//return new SmartObjectContext();
418+
// return new SmartObjectContext();
419419
return null;
420420
}
421421

src/Presentation/SmartStore.Web.Framework/Filters/HandleInstallFilter.cs

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,28 @@
44

55
namespace SmartStore.Web.Framework.Filters
66
{
7-
public class HandleInstallFilter : IActionFilter
8-
{
9-
public void OnActionExecuting(ActionExecutingContext filterContext)
10-
{
11-
var controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;
12-
var actionName = filterContext.ActionDescriptor.ActionName;
7+
public class HandleInstallFilter : IAuthorizationFilter
8+
{
9+
public void OnAuthorization(AuthorizationContext filterContext)
10+
{
11+
var controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;
12+
var actionName = filterContext.ActionDescriptor.ActionName;
1313

14-
if (controllerName == "Install" && actionName != "Index" && filterContext.HttpContext.Request.IsAjaxRequest())
15-
{
16-
// probably "progress" or "finalize" call
17-
return;
18-
}
14+
if (controllerName == "Install" && actionName != "Index" && filterContext.HttpContext.Request.IsAjaxRequest())
15+
{
16+
// probably "progress" or "finalize" call
17+
return;
18+
}
1919

20-
if (!DataSettings.DatabaseIsInstalled() && controllerName != "Install")
21-
{
22-
filterContext.Result = new RedirectToRouteResult(
23-
new RouteValueDictionary {
24-
{ "Controller", "Install" },
25-
{ "Action", "Index" }
26-
});
27-
}
28-
}
29-
30-
public void OnActionExecuted(ActionExecutedContext filterContext)
31-
{
32-
// nada
33-
}
34-
35-
}
20+
if (!DataSettings.DatabaseIsInstalled() && controllerName != "Install")
21+
{
22+
filterContext.Result = new RedirectToRouteResult(
23+
new RouteValueDictionary {
24+
{ "Controller", "Install" },
25+
{ "Action", "Index" }
26+
});
27+
}
28+
}
29+
}
3630

3731
}

src/Presentation/SmartStore.Web.Framework/Validators/ValidatorLanguageManager.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,26 @@
33
using System.Web.Hosting;
44
using FluentValidation;
55
using FluentValidation.Resources;
6+
using SmartStore.Core.Data;
67
using SmartStore.Core.Infrastructure;
78
using SmartStore.Services;
89

910
namespace SmartStore.Web.Framework.Validators
1011
{
1112
public class ValidatorLanguageManager : LanguageManager
1213
{
14+
private readonly bool _canResolveServices;
15+
16+
public ValidatorLanguageManager()
17+
{
18+
_canResolveServices = DataSettings.DatabaseIsInstalled() && HostingEnvironment.IsHosted;
19+
}
20+
1321
public override string GetString(string key, CultureInfo culture = null)
1422
{
1523
string result = base.GetString(key, culture);
1624

17-
if (HostingEnvironment.IsHosted)
25+
if (_canResolveServices)
1826
{
1927
// (Perf) although FV expects a culture parameter, we gonna ignore it.
2028
// It's highly unlikely that it is anything different than our WorkingLanguage.

src/Presentation/SmartStore.Web/Controllers/HomeController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public HomeController(
4848
Lazy<CommonSettings> commonSettings,
4949
Lazy<SeoSettings> seoSettings,
5050
Lazy<CustomerSettings> customerSettings,
51-
Lazy<PrivacySettings> privacySettings,
52-
Services.Directory.ICountryService countryService)
51+
Lazy<PrivacySettings> privacySettings)
5352
{
5453
_categoryService = categoryService;
5554
_productService = productService;

src/Presentation/SmartStore.Web/Global.asax.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ protected void Application_Start()
164164
// app not installed
165165

166166
// Install filter
167-
GlobalFilters.Filters.Add(new HandleInstallFilter());
167+
GlobalFilters.Filters.Add(new HandleInstallFilter(), -1000);
168168
}
169169
}
170170

0 commit comments

Comments
 (0)