Adds some exception handling to the rel links data upgrader, always nice not to blow up the upgrader

This commit is contained in:
Tim Geyssens
2013-11-21 08:53:13 +01:00
parent 345340b957
commit 05cd6500ba

View File

@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using System.Web.Script.Serialization;
using System.Xml;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.Rdbms;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
@@ -23,7 +24,11 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
{
if (database != null)
{
var propertyData = database.Fetch<PropertyDataDto>("WHERE propertyTypeId in (SELECT id from propertyType where dataTypeID = 21)");
try
{
var propertyData =
database.Fetch<PropertyDataDto>(
"WHERE propertyTypeId in (SELECT id from propertyType where dataTypeID = 21)");
foreach (var data in propertyData)
{
//fetch the current data (that's in xml format)
@@ -51,7 +56,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
link.Add("edit", false);
link.Add("isInternal", type.Equals("internal"));
links.Add((ExpandoObject)link);
links.Add((ExpandoObject) link);
}
//store the serialized data
@@ -59,6 +64,11 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
}
}
}
catch (Exception ex)
{
LogHelper.Error<UpdateRelatedLinksData>("Exception was thrown when trying to update related links property data", ex);
}
}
return string.Empty;
}