Domain Expiration Task Fixes
This commit is contained in:
parent
32f259ecec
commit
81162ca00e
3 changed files with 24 additions and 7 deletions
|
@ -42,6 +42,7 @@ using WebsitePanel.Providers.HostedSolution;
|
|||
using Whois.NET;
|
||||
using System.Text.RegularExpressions;
|
||||
using WebsitePanel.Providers.DomainLookup;
|
||||
using System.Globalization;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer
|
||||
{
|
||||
|
@ -72,6 +73,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
@"expires:(.+)" //.fi
|
||||
};
|
||||
|
||||
private static List<string> _datePatterns = new List<string> { @"ddd MMM dd HH:mm:ss G\MT yyyy"
|
||||
};
|
||||
|
||||
#region Servers
|
||||
public static List<ServerInfo> GetAllServers()
|
||||
{
|
||||
|
@ -2723,7 +2727,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
if (match.Success && match.Groups.Count == 2)
|
||||
{
|
||||
return DateTime.Parse(match.Groups[1].ToString().Trim());
|
||||
return ParseDate(match.Groups[1].ToString().Trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2731,6 +2735,21 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return null;
|
||||
}
|
||||
|
||||
private static DateTime? ParseDate(string dateString)
|
||||
{
|
||||
var result = DateTime.MinValue;
|
||||
|
||||
foreach (var datePattern in _datePatterns)
|
||||
{
|
||||
if (DateTime.TryParseExact(dateString, datePattern, CultureInfo.InvariantCulture, DateTimeStyles.None, out result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return DateTime.Parse(dateString);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DNS Zones
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue