Copied to clipboard

Flag this post as spam?

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


  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Apr 04, 2013 @ 13:05
    Bo Damgaard Mortensen
    0

    Updating the Umbraco XML cache when a node is moved

    Hi all,

    First of all: thanks for a great package which I've used in a lot of projects :-)

    I've encountred a prolem in the latest uDateFoldersy running on Umbraco version 6.0.2. I have the following content structure:

    - Content
         - News
              - 2012
                   - Jan
                        - Newsitem 1
                        - Newsitem 2
              - 2013
                   - Apr
                        - Newsitem 3
                        - Newsitem 4
    

    The "newsItem" document type has got a datepicker which I use as the datePropertyAlias in uDateFoldersy.config. Like this:

    <DatePropertyAlias>newsDate</DatePropertyAlias>

    Now, when I set the datepicker on Newsitem 3 to January 2012 and publish the node, it gets moved to News/2012/Jan as it should. However, in the umbraco.config XML, the XML isn't moved. The parentID is set correctly, but the Newsitem XML remains as a child element of the 2013/Apr node.

    Parsing this in XSLT, it gives unexpected results :-) Since the following expression:

    $currentPage/yearFolder/monthFolder/NewsItem [@isDoc]

    naturally proceses the XML tree structure.

    I think it may have something to do with the uDateFoldersy service not calling umbraco.library.UpdateDocumentCache() (or equivalent in v6 API) when the node is moved? :-) Just a quick shot in the dark, really.

    Any help/hint is greatly appreciated!

    Thanks in advance.

    - Bo

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Apr 04, 2013 @ 13:32
    Anthony Dang
    0

    Interesting...

    The package does it's work on the save event.

    Are you clicking publish?

     

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Apr 04, 2013 @ 13:45
    Bo Damgaard Mortensen
    0

    Hi Anthony,

    Yup, I click the 'Save and Publish' icon :-)

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Apr 04, 2013 @ 14:01
    Anthony Dang
    0

    hmm... Publish event is after Save. So any move of a node should be published.

    Any chance of upgrading to umbraco 6.0.3 to see if there's any fix in there for the issue?

     

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Apr 04, 2013 @ 14:52
    Bo Damgaard Mortensen
    0

    Hi again Anthony,

    Sure thing :-) Wanted to upgrade it anyway. Just upgraded to latest version of Umbraco (6.0.3), but it didn't make any difference :-/ It changes the the parentID attribute, but the XML stays as a child element of the same month folder.

    Thanks again.

    - Bo

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Apr 04, 2013 @ 14:58
    Bo Damgaard Mortensen
    0

    If I run the "Republish entire site" after I have set a different date (i.e. switching from 2012 to 2013), it does move the XML aswell though :-)

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Apr 04, 2013 @ 15:25
    Anthony Dang
    0

    A work around... hit save. That will move the node.

    Then hit "save and publish"

     

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Apr 04, 2013 @ 15:59
    Bo Damgaard Mortensen
    0

    Thanks Anthony :-) Although, I did another workaround which isn't pretty at all, but works (isn't that the mantra of workarounds, btw? ;-)) by hitting:

    <xsl:variable name="refreshCache" select="umbraco.library:RefreshContent()" />

    before rendering any news. That did the trick aswell. It's not pretty and it's certainly not that performant, but it works ;-)

    All the best,

    Bo

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Apr 04, 2013 @ 17:24
    Anthony Dang
    0

    eeek!... maybe it would be better to create an event hook for the after publish event of that doctype to do a refresh cache.

     

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Apr 05, 2013 @ 08:57
    Bo Damgaard Mortensen
    0

    You're right, Anthony :-) Don't know why I didn't think of that. D'uh!

    The site itself dosn't have that many nodes though, so the cacherefresh still performs alright.

    I'll definitely refresh the cache in the after publish event, though. Good call there!

    - Bo

Please Sign in or register to post replies

Write your reply to:

Draft