Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Dan White 206 posts 510 karma points c-trib
    Aug 21, 2014 @ 00:00
    Dan White

    Maintaining localLink

    First of all, fantastic package! 

    Since the nodeId is changed during the initial sync. How would you go about maintaining the localLink references that the RTE stores for hyperlinks?

  • Antoine 176 posts 1494 karma points
    Sep 03, 2014 @ 10:26

    Hi Dan, sorry for the delay, I was out os office.

    I usually do this kind of stuff into the proxy method:

    • Search with a regex expression or xpath all occurrence of old references in the legacy umbraco.config.
    • Get the new Id of the reference in the new Umbraco cache. The legacy nodeId is supposed to be stored into a property in the new instance for the mirroring.
    • Update de XML source of  uMirror with the new nodeId.

    Example for an umbracoRedirect property, not exactly your case but similar:

    /* Read the legacy umbraco.config */
    string SourceFilePath = HttpContext.Current.Server.MapPath("\\App_Data\\umirror\\umbraco.config");
    string umbracoconfig = System.IO.File.ReadAllText(SourceFilePath);
    XDocument xml = XDocument.Parse(umbracoconfig);
    /* Get umbraco content */
    XmlDocument XmlContent = ((XmlDocument)content.Instance.XmlContent.Clone());
    /* Update value */
    foreach (XElement index in xml.XPathSelectElements("//umbracoRedirect").Where(r => !string.IsNullOrEmpty(r.Value)).ToList())
                if (XmlContent.SelectSingleNode("//* [legacyId = " + index.Value + "]") != null)
                    index.Value = XmlContent.SelectSingleNode("//* [legacyId = " + index.Value + "]").Attributes["id"].Value;
Please Sign in or register to post replies

Write your reply to: