Copied to clipboard

Flag this post as spam?

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


  • trfletch 598 posts 604 karma points
    Sep 16, 2015 @ 16:35
    trfletch
    1

    cmsContentXml not regenerating even when running republish.aspx?xml=true

    I have a large Umbraco 6.2.4 website which I am looking to upgrade to Umbraco 7. This site has been upgraded a few times and started on version 4. During the testing ready for upgrade I have come across an issue whereby the cmsContentXml table will not regenerate.

    I have had to manually update some fields in the cmsPropertyData table and whilst trying to get the XML cache to update I noticed that the cmsContentXml will not pick up the changes.

    I have tried running /Umbraco/dialogs/republish.aspx?xml=true which appears to complete successfully after a few minutes but it does not regenerate the cmsContentXml table.

    Even if I clear out the cmsContentXml table then run /Umbraco/dialogs/republish.aspx?xml=true it will take a few minutes to run through but the cmsContentXml table will be empty at the end.

    If I am then to go into a node in the Umbraco backend and publish it, this node will get added to the cmsContentXml table but nothing else. I have over 70000 nodes so republishing each one isn't really an option.

    I have checked the event log and the UmbracoLog table and I cannot see anything that suggests what could be the problem.

    Please can anyone offer any help on this issue?

  • Mark Bowser 273 posts 860 karma points c-trib
    Sep 16, 2015 @ 16:47
    Mark Bowser
    0

    As far as I understand, when you right click and republish the entire site or /umbraco/dialogs/republish.aspx?xml=true, the xml cache on disk is updated from the xml cache in the database. Those republishes are sort of a shallow republish. As you have seen, to do a more thorough republish that will regenerate the cmsContentXml table, you can go to each individual node and click "Save and Publish" because that causes the full republish all the way down to the cmsContentXml. You should be able to right click on a node in the umbraco backoffice (probably the home page in your case) and then click publish and check "Publish Homepage and all of its subpages" to cause the deep republish to happen to nodes en masse. Because the deep republish hits the database, this mass, deep republish might take a while to complete.

    Hope that helps.

  • trfletch 598 posts 604 karma points
    Sep 16, 2015 @ 19:46
    trfletch
    0

    I thought the XML=true option was supposed to refresh the cmsContentXML table as well as rebuild the umbraco.config file but maybe I am wrong, which seems to be the case based on my testing. To actually republish all the nodes would take a very long time and I am pretty sure when I have tried this before from within umbraco by right clicking on the top level of a large website it ends up timing out.

  • trfletch 598 posts 604 karma points
    Sep 17, 2015 @ 14:48
    trfletch
    0

    Is anyone able to clarify either way whether or not I should be able to rebuild the cmsContentXml table without having to publish every single node in my website?

    If I do have to publish every single node then I will need to write something do this by looping through each node because I am sure that the publish features in Umbraco will time out with the sheer amount of nodes in my website.

  • Mark Bowser 273 posts 860 karma points c-trib
    Sep 17, 2015 @ 16:45
    Mark Bowser
    0

    You could try doing it in chunks. Start at a lower level node maybe?

    I was looking around in the umbraco services documentation and found something that looks promising on the ContentService. Haven't tried it yet. Let me know if it works:

    .RebuildXmlStructures(params int[] contentTypeIds)
    
        Rebuilds all xml content in the cmsContentXml table for all documents matching the IDs passed in.
        If none then rebuilds the structures for all content.
    

    https://our.umbraco.org/documentation/Reference/Management/Services/ContentService

  • trfletch 598 posts 604 karma points
    Sep 18, 2015 @ 16:27
    trfletch
    0

    Hi Mark,

    Thank you for the response, I had a look at this but it appears the .RebuildXmlStructures option no longer exists, the only one I could find that was similar was .RepublishAll but I tried that and it does not update the cmsContentXml table.

    Any other suggestions or does it look like I am going to have to split the nodes into chunks and use .PublishWithStatus or .PublishWithChildrenWithStatus?

  • Bill 43 posts 65 karma points
    Apr 06, 2016 @ 15:35
    Bill
    0

    Hi Mark,

    I'm encountering this too, what approach did you take in the end please?

    Previously, republish.aspx?xml=true did indeed rebuild the cmsContentXml table but since v7 it looks like the query string doesn't do anything anymore.

    My site has 100k + nodes. A manual republish just isn't feasible.

    Really hope to hear back from you!

  • trfletch 598 posts 604 karma points
    Apr 06, 2016 @ 15:46
    trfletch
    0

    I had to write a custom usercontrol that looped through all nodes and published them manually. This wasn't too much of an issue for me because I was working on a test site.

  • Bill 43 posts 65 karma points
    Apr 06, 2016 @ 15:49
    Bill
    0

    Gah. Thanks for the reply.

    Can't pretend it's not annoying!

  • Bill 43 posts 65 karma points
    Apr 08, 2016 @ 14:11
    Bill
    0

    I've got a workable solution to updating the cmsContentXml table without using the built-in republish.aspx?xml=true feature and without doing a monster republish:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using System;
    @using umbraco.cms.businesslogic.web;
    
    @{
        Layout = null;
        var start = DateTime.Now;
    
        Server.ScriptTimeout = Int32.MaxValue;
        System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
    
        var startNode = Request.QueryString["start"];
    
        var docsToClear = Umbraco.TypedContentAtRoot().DescendantsOrSelf(Request.QueryString["dt"]);
    
        if (startNode != null)
        {
            docsToClear = Umbraco.TypedContent(startNode).DescendantsOrSelf(Request.QueryString["dt"]);
        }
    }
    <ul>
        @foreach (var doc in docsToClear)
        {
            try
            {
                var d = new Document(doc.Id);
                d.XmlGenerate(xd);
                <li>Created Xml for:  @doc.Id @(doc.Name)</li>
            }
            catch (Exception e)
            {
                <li>ERROR Xml for:  @doc.Id <br /><br />@e.Message</li>
            }
        }
    </ul>
    @{
        umbraco.library.RefreshContent();
    }
    @docsToClear.Count() nodes refreshed. Time expired: @(DateTime.Now - start)
    

    I'm under no illusions - this is a bit quick and dirty and is suited to my purpose of refreshing all the nodes of a particular type but is easy to change and might be useful to someone...

    B

Please Sign in or register to post replies

Write your reply to:

Draft