Final touches to rel links data upgrader

This commit is contained in:
Tim Geyssens
2013-11-21 10:41:42 +01:00
parent 16ea928c75
commit 92c28de028

View File

@@ -34,6 +34,8 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
{
if (!string.IsNullOrEmpty(data.Text))
{
var cs = ApplicationContext.Current.Services.ContentService;
//fetch the current data (that's in xml format)
var xml = new XmlDocument();
xml.LoadXml(data.Text);
@@ -59,6 +61,20 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
link.Add("edit", false);
link.Add("isInternal", type.Equals("internal"));
try
{
if (type.Equals("internal"))
{
int nodeId;
if (int.TryParse(lnk, out nodeId))
link.Add("internalName", cs.GetById(nodeId).Name);
}
}
catch (Exception ex)
{
LogHelper.Error<UpdateRelatedLinksData>("Exception was thrown when trying to update related links property data, fetching internal node id", ex);
}
links.Add((ExpandoObject) link);
}