Copied to clipboard

Flag this post as spam?

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


  • overflew 87 posts 110 karma points
    Jan 12, 2011 @ 06:03
    overflew
    0

    Determining the number of times a node has been published

    Hi there,

    I'm looking at my options for determined if a document has been published more than once - essentially to figure out if the document is 'new' or 'updated'.

    The number of linked document versions isn't quite it, as that also includes saved copies. Is my only option to pull out the log for that node (umbraco.BusinessLogic.Log.GetAuditLogReader?), and count up the Publish events myself? (And probably try subtract the rollbacks...). Is there another way to do this?

    Thanks in advance.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Jan 12, 2011 @ 07:35
    Aaron Powell
    1

    You can read through the log table, but I think that to do what you want could become a really tricky one for long-term maintenance.

    It'll be easier to write code that uses the Publish event handler and tracks them yourself. In the event handler I'd write to a custom DB table and include the ID of the node and the publish date stamp. That way you can run reports like:

    - How often was node 1234 published
    - How many nodes were published between two dates
    - What nodes were published on day blah

    (and so on)

    Oh, and I'd use an ORM like LINQ to SQL or EF4 rather than the Umbraco data layer so you don't have to write the SQL code yourself.

     

Please Sign in or register to post replies

Write your reply to:

Draft