Reputation: 1948
I've got a webapp (basically a CMS) running on Apache built with PHP5/MySQL. Which would be the best practice to create a demo version on the web?
The only way I can think of is duplicating the entire database for each new user and running a cron job one or twice a day to remove those duplicates.
Upvotes: 0
Views: 851
Reputation: 48963
I have seen the method you are talking about before, a site would create a whole new demo for you. Instead of a user for the app you would get to demo a whole new fresh version.
The way I would do it is to keep 1 copy of the code, and then in the DB connection area, have it select the appropriate DB for each demo user created. I would then run a cron job to delete old demo DB's after x amount of days
Upvotes: 1
Reputation: 66851
I don't think it's necessary to duplicate the entire database for each user (they should all be using the same demo account anyways). It seems that what most demo apps do is periodically restore the database to its original condition. Like every 6 hours or so all tables get cleared - something along those lines.
Upvotes: 0
Reputation: 5561
What these guys said is fine, just make sure you have some measures in place to flag dodgy content. If your CMS allows picture uploads then people could upload all sorts of nasties.
You could also just create a new field in the database that stores users session IDs and only display the content that the particular user has uploaded/edited. Be a little more work but safer if your worried about dodgy content being published for all to see.
Upvotes: 1
Reputation: 723
You could also try creating a default username and password. Get the system to a state that you like then using cron flush and rebuild every so often.
Upvotes: 0
Reputation: 6170
What I've seen in other demos is that they use only one demo for all the users and use cron to load a fresh copy of the database once a day.
Upvotes: 0
Reputation: 24462
Most CMS demos just create 1 user (guest) and display that login information before the user gets to the demo. Then every few hours or once a day they run a cron job that restores the databases to their original condition. That way you won't need to deal with multiple logins, cloning databases, etc. A good example of this system in action is opensourcecms.com
Upvotes: 0