tags:

views:

120

answers:

6

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.

A: 

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.

ryeguy
What if two users are logged in simultaneously? There would be changes in the interface and/or information that they wouldn't be expecting and might asume it doesn't work right.
Gerardo
Well it IS a multiuser application, right? How many web apps do you know of that only allow one user on at a time? There is no easy solution to this problem then other than your own.
ryeguy
A: 

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

tj111
A: 

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.

Randell
A: 

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.

Bob Breznak
+1  A: 

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.

Evernoob
+1  A: 

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

jasondavis