Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Item changelogs and rollback
September 29, 2008, 11:39 am
rate this thread
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
I would like to add this capability for 2 reasons:
a) To see what changes have been made to an article since its last
b) To be able to "roll back" changes to an earlier revision if
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.
Re: Item changelogs and rollback
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
JDS Computer Training Corp.
- C. (http://symcbean.blogspot.c
September 29, 2008, 11:53 am
- » "undefined symbol: php_ini_opened_path" On Apache startup
- — Previous thread in » PHP Scripting Forum