I have a website to demo plugins, and I want to allow users to login, but I am not sure how to reset the website once they log out. Is there a way to create a separate instance of WordPress for each new user and then delete itself once that user logs out? Or is there a way to reset a WordPress site once a day (not reset database and completely reset site), but keep the plugin activated and setup?
1 comment
Comments are closed.
One way to solve this would be to set up your demo site exactly how you want it to reset every day (use a standard username and pass like “admin” and “testpass”), and then dump the database and zip the files. Then, put the zip somewhere on your server. Set up a BASH script that deletes the contents of the current WordPress directory, drops all the tables from the database, copies the zip file in, unzips it, and then imports the database file to the db. Then, you can set up a cron to run the file every night at midnight. Here’s some info on how to set up a cron:
http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
Give me a bit and I’ll whip up a code example.
EDIT:
Once you have your files zipped, you can write a BASH script like this:
Something like that should get the job done. Just put this into a file like “reset-test-site.sh”, and set up a cron to run the script every night at midnight.
Also, note the lack of a space in the mysql command between the “-p” option and the actual password. This is NOT a typo, and is the way this command works. Just wanted to make sure you know this isn’t an error.