Copied to clipboard

Flag this post as spam?

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


  • Paul Yates 32 posts 86 karma points
    Mar 30, 2011 @ 12:14
    Paul Yates
    1

    Media updateDate not being updated

    When displaying media items that are listed using umbraco.library.GetMedia, the createDate and updateDate properties are always identical.  Always the same as the original createDate.  So if i go into the media and update the media item (eg upload a different file on the same item), the updateDate does not get changed.  

     

      <xsl:variable name="mediaFolderNumber" select="1104"/>
      <xsl:for-each select="umbraco.library:GetMedia($mediaFolderNumber,'true')/descendant::* [umbracoFile]">
        <p>
        Created:<xsl:value-of select="./@createDate"/><br/>
        Updated:<xsl:value-of select="./@updateDate"/>
        </p>
      </xsl:for-each>

     

    I am using umbraco 4.5.2

    Is this a bug or my lack of understanding?

    Thanks

    Paul

  • Daniel Bardi 927 posts 2562 karma points
    Mar 30, 2011 @ 12:32
    Daniel Bardi
    0

    Try the last modified date  (i.e. lastModifiedDate)

  • Paul Yates 32 posts 86 karma points
    Mar 30, 2011 @ 13:20
    Paul Yates
    0

    This isn't in the GetMedia() xml though...

    for each <file> I only have 

    id,version,parentid,level,writerid,nodetype,template,sortorder,createdate,updatedate,nodename,urlname,writername,nodetypealias,path

  • Daniel Bardi 927 posts 2562 karma points
    Mar 30, 2011 @ 13:23
    Daniel Bardi
    0

    hmm.. guess it's only part of a content node... odd.

    I'll have to think about.. late here..

  • Paul Yates 32 posts 86 karma points
    Apr 06, 2011 @ 13:27
    Paul Yates
    0

    Anyone got any ideas about this?

    I'd see if i could debug this myself but as i'm so new to umbraco i wouldnt know where to start...

  • mscommunities 40 posts 95 karma points
    May 12, 2011 @ 20:47
    mscommunities
    0

    I am having the same issue on 4.6.1. Is there another way I can determine whether or not the media node has been updated? I tried 'version' but this does not work as well.

  • Paul A 133 posts 368 karma points
    May 16, 2011 @ 10:56
    Paul A
    0

    Having same prob on 4.7.

  • Murray Roke 503 posts 966 karma points c-trib
    Sep 13, 2011 @ 05:17
    Murray Roke
    1

    I've added a bug to codeplex http://umbraco.codeplex.com/workitem/30467

  • Murray Roke 503 posts 966 karma points c-trib
    Sep 13, 2011 @ 05:30
    Murray Roke
    1

    Here's a work around, add this event handler to update the date.

    public class Application : ApplicationBase
    {
        public Application()
        {
            Media.BeforeSave += SetUpdateDate;
        }
        private void SetUpdateDate(Media sender, SaveEventArgs e)
        {
            sender.VersionDate = DateTime.Now;
        }
    }
    
  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 20, 2012 @ 01:15
    Jeroen Breuer
    0

    If you update the media with this workaround you should also add this code:

    sender.Save();
    sender.XmlGenerate(new XmlDocument());

    That way the xml also get's updated if you use library.GetMedia.

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 20, 2012 @ 01:19
    Jeroen Breuer
    0

    Hmm calling sender.Save() in a save event might cause an infinite loop :p. Since it's in the before save event the xml will probably get updated automatically. I guess you can forget what I said :).

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft