mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 03:58:13 +08:00
Preventing TimeZone from crashing if the migration cannot run before using it
--HG-- branch : 1.x
This commit is contained in:
@@ -13,11 +13,18 @@ namespace Orchard.Time {
|
||||
}
|
||||
|
||||
public TimeZoneSelectorResult GetTimeZone(HttpContextBase context) {
|
||||
|
||||
try {
|
||||
var siteTimeZoneId = _workContextAccessor.GetContext(context).CurrentSite.SiteTimeZone;
|
||||
|
||||
if (String.IsNullOrEmpty(siteTimeZoneId)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch {
|
||||
// if the database could not be updated in time, ignore this provider
|
||||
return null;
|
||||
}
|
||||
|
||||
return new TimeZoneSelectorResult {
|
||||
Priority = -5,
|
||||
|
||||
Reference in New Issue
Block a user