Page 1 of 1

ROLLBACK for CMS changes

Posted: Wed Jun 22, 2011 11:19 am
by rhecker
Because the WYSIWYG view of my custom CMS is not perfect (using tinyMCE), it's useful for users to have an open window of the page being worked on, which they refresh in order to view changes after they are submitted to the MySQL database.

Unfortunately, they can't undo a change once it is submitted. MySQL ROLLBACK and savestate don't seem to be the solution because they don't update the table until COMMIT, so the user doesn't see the change reflected in the open page window.

This must be an issue someone has found a solution for. Does anyone know?

Re: ROLLBACK for CMS changes

Posted: Wed Jun 22, 2011 11:58 am
by John Cartwright
Why not just store the previous versions (up to a certain number)? And allow them to specify the revision they want to revert back to.

Re: ROLLBACK for CMS changes

Posted: Wed Jun 22, 2011 1:11 pm
by rhecker
Yes, that's the idea I'm looking for. Would you suggest doing that in the database or by saving the array of variables somehow with PHP? If in the database, then that's what I first thought rollback would provide.

Re: ROLLBACK for CMS changes

Posted: Wed Jun 22, 2011 1:46 pm
by twinedev
On my CMS, I use a field called "Type" which is an enum('LIVE','ARCHIVE','DRAFT') LIVE has only have one copy the actual copy viewsers see, DRAFT can have ONE copy that allows people to be actively working on changes, and they can give a specific URL to others to review it, ARCHIVE can have up to 10 copies which are auto made from the previous LIVE copy each time a new save is made.

-Greg

Re: ROLLBACK for CMS changes

Posted: Wed Jun 22, 2011 2:14 pm
by John Cartwright
rhecker wrote:Yes, that's the idea I'm looking for. Would you suggest doing that in the database or by saving the array of variables somehow with PHP? If in the database, then that's what I first thought rollback would provide.
Rollbacks are meant to roll back data from a transaction, not from any point in history.

Every time they have a new copy to be saved, create a new record in your "history" table and update the latest revision id to their user table.

Then when they want to "revert" back to a previous version, you can present all the different revisions and allow them to choose and/or implement back/forward functionality.

Re: ROLLBACK for CMS changes

Posted: Wed Jun 22, 2011 3:29 pm
by rhecker
Thanks for the ideas. I can implement something like this easily enough.