Re: Item changelogs and rollback



Gordon wrote:
I have been wanting to add a changelog capability to our in house CMS
system. The approach I was thinking of was adding a changelog table
to the database. It records the ID of the editor, the timestamp of
when the edit occurred and a list of changes made to the item
edited.

I would like to add this capability for 2 reasons:

a) To see what changes have been made to an article since its last
edit
b) To be able to "roll back" changes to an earlier revision if
necessary

The easy way would be to simply store the entire text of the article
each time in the changelog, but that is of course very wasteful. What
I'd really like to do is store the difference between the current and
the previous version.

Is there a way of achieving this in PHP? I found a few functions in
the manual that claim to analyse strings and work out the differences
but these functions seem to return integers, and what I'd ideally need
is something akin to the output of utilities like diff.


You can do it, but it will be complicated. If you can exec() diff and patch, that will help (but you'll have to save the article to a file temporarily, anyway). Otherwise you'll need to write your own code to get the differences and make the changes.

I think it would be easier to just store the entire article. They aren't that big, are they?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================

.



Relevant Pages

  • Re: Item changelogs and rollback
    ... It records the ID of the editor, the timestamp of ... The easy way would be to simply store the entire text of the article ... Why not use diff with temporary files. ...
    (comp.lang.php)
  • Re: XML Merge/Diff tool?
    ... > Is there a tool that will merge XML documents? ... we need to be able to create a Diff of two documents. ... > different levels of hierarchy in our configuration store. ... > this lower level we need to merge the two documents together (lower ...
    (microsoft.public.dotnet.xml)
  • Re: logging time spent on my website
    ... I store the timestamp in db ok thats cool. ... Thats why I was thinking of a endless loop. ... > you now have 2 items, last length of time, and current time stamp. ...
    (comp.lang.php)
  • Re: Optimistic Concurrency in a web app
    ... My question was more about how to handle and more specifically when to store the timestamp value: from the initial server postback, after an edit control is displayed to the user or finally when the user posts back. ... When I first display the label version of a field? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Data Base Interface Wizard update problem
    ... Excuse me what do you mean by timestamp field?In my access database i need a ... field of type date/time in order to store the date ... separate field with type timestamp? ...
    (microsoft.public.frontpage.client)