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?
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.
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.
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.
is working on a reply...