Copied to clipboard

Flag this post as spam?

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


  • Nik Wahlberg 639 posts 1237 karma points MVP
    Sep 07, 2011 @ 03:46
    Nik Wahlberg
    0

    Creating and Audit Table

    Hi guys an gals,

    I'm in the process of creating an audit table for content nodes as a dashboard in Umbraco and I'm a little stuck. So far, I have something that sort of works by going to the database and grabbing a slew of records from the umbracoLog table and joining those returns to the cmsDocument table as well as the umbracoUser table. Here's what that looks like: 

    select ul.id as logId,ul.NodeId,cd.text as pageName, ul.Datestamp, 
        uu.id as userId, uu.userName, uu.userLogin, 
        cd.versionId
    from umbracoLog ul
    inner join umbracoUser uu on ul.userId=uu.id
    left join cmsDocument cd on ul.NodeId=cd.nodeId
    where   1=1
    and cd.newest=1
    and ul.logHeader='Publish'
    order by ul.Datestamp desc, cd.updateDate desc

    However, this always produces the latest versionId for the pages and this is where I'm stuck. How do I map a version ID to the change that was made ata certain time. The timestamps don't necessarily match, so I can't use that as a paramater. I suppose one way is to try and do some funky logic and do nested loops over various sql queries. But, before I go down that road I wanted to check if someone might have a solution for something like this already (that they don't mind sharing). 

    Thanks a heap! 

    -- Nik

Please Sign in or register to post replies

Write your reply to:

Draft