ROLLBACK for CMS changes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rhecker
Forum Contributor
Posts: 178
Joined: Fri Jul 11, 2008 5:49 pm

ROLLBACK for CMS changes

Post 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?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: ROLLBACK for CMS changes

Post 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.
rhecker
Forum Contributor
Posts: 178
Joined: Fri Jul 11, 2008 5:49 pm

Re: ROLLBACK for CMS changes

Post 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.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: ROLLBACK for CMS changes

Post 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
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: ROLLBACK for CMS changes

Post 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.
rhecker
Forum Contributor
Posts: 178
Joined: Fri Jul 11, 2008 5:49 pm

Re: ROLLBACK for CMS changes

Post by rhecker »

Thanks for the ideas. I can implement something like this easily enough.
Post Reply