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.
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.
Comment