How to create a Joomla 1.5 demo website that refreshes every hour
by
on August 26th, 2008 at 12:00 AM (1979 Views)
Please note that this blog post is outdated and the latest version of this tutorial/post is available at, http://www.jv-extensions.com/blogs/s...iodically.html
Do you have products orJoomla extensions which you want to showcase toyour customers andwebsite visitors using a demo that they can play with entirely? Or just want to showcase demo ofJoomlafor prospective customers?
Here is a short tutorial of how we have managed to create a demo site for our products such that the demo website is refreshed or recreated once every hour. The refresh is necessary to ensure that, the next set of visitors, get the originally created demo configuration andnotthe changes made inthe last 1 hour by other visitors. Please feel freeto add any other tips or ideas with their comments.
Here we assume that we are creating the demo in http://demo.yoursite.com, which is physically at /home/{user}/public_html/demo folder for example.
Install and Configure the Demo site:Secure your Demo site:
- Install the latest version of Joomla 1.5 in your demo subdomain
- Ensure that the demo installation is successful by being able to browse through the joomla webpages inyour demo site in frontend and backend
- Now install your extensions at backend as you would normally do so.
- Configure your extensions theway you want them to be used as demo. Remember that, the visitors inthe demo are supposed to be editing the configuration ofyour component at backendand play around with it. So make the configuration as minimal as possible.
- Create the necessary menu items for your extensions so that the extensions can be used from frontend as well (assuming they are components that need a menu item)
Make it ready for restoration every hour:
- In the global configuration, disable FTP
- Login toyour demo site backendand change the login username ofthe Super Administrator account to something other than the default "admin". Also set the password ofthis account to something only you know!
- Using the user manager, create a new user. Ensure that the new user has a common username such as "admin". Set the password to be "admin". This account will be used by the demo visitors to login to demo site backend
- For the newly created user, set the group as "Manager".
- Now browse through the frontend and backend pages and make sure that everything is fine about Joomla and your extensions
Thats it! As cron fires your job every hour, the restore.sh script will execute the contents of database dump file which will remove all existing tables and recreate them inthe demo joomla database. Subsequently it will remove the contents ofthe (messy) websitein public_html/demo folder and copy the original demo files from the backedup /home/{user}/demo.restorefrom/demo folder. So every hour whatever be the kind of mess your demo website is in, it will be restored to a clean configuration for fresh round of chaos!
- Create a new folder by name "demo.restorefrom" in /home/{user} folder. Also create a new folder called "demo" under /home/{user}/demo.restorefrom. Note that they must NOT be under public_html folder.
- Using the control panel ofyour hosting account orusing SSH, just copy the entire contents of /home/{user}/public_html/demo recursively to /home/{user}/demo.restorefrom/demo folder
- Now to go phpmyadmin and take a complete SQL dump ofthe database tables used by theJoomla demo website. Note the database name, mysql username and mysql password as well.
- Upload the database .sql dump file to /home/{user}/demo.restorefrom folder
- Create a restore.sh shell script withthe following contents
Code:mysql {database name} -u{mysql username} -p{mysql password} rm -rf /home/{user}/public_html/demo/* cp -rf /home/{user}/demo.restorefrom/demo/* /home/{user}/public_html/demo/
- Upload the restore.sh to /home/{user}/demo.restorefrom folder
- Go to cron jobs in hosting control panel and add the following entry to it.
/bin/sh /home/{user}/demo.restorefrom/restore.sh
- Configure the cron entry in such a way that the restore.sh is fired every hour (0 * * * *)
Also do not forget to replace the paths, folders and filenames specific toyourinstallationin place of placeholders inthethe above scripts before use. You may also wish to chmod all files and folders to 644 and 755 inthe script to ensure that the permissions are intact after a restore.








Email Blog Entry