Hi,
I moved this topic to Data Import section.
Please read: viewtopic.php?f=21&t=815 about using the Import module.
It is critical, that you make a backup of the database before you import anything - in case something goes wrong. Ideally you should setup a second installation of epesiBIM - a clone of the live one:
- make a copy of the database (for example the live database name is "epesi" and the clone is "epesi-clone")
- make an exact copy of the entire epesi installation and place it in another folder
- make another virtual host or run it from another subdirectory
- make changes in the configuration file of the cloned installation to point to the cloned database ("epesi-clone")
If you are on Linux you can use the following script:
#!/bin/sh
cd /var/www
mv epesi-clone/data/config.php /tmp/config-epesi-clone.php.bak
cp epesi-clone/data/Base_MainModuleIndicator/logo.gif /tmp/logo.gif.bak
echo Remove clone
rm -R epesi-clone
echo Clone live to clone
cp -R epesi epesi-clone
mv -f /tmp/logo.gif.bak epesi-clone/data/Base_MainModuleIndicator/logo.gif
mv -f /tmp/config-epesi-clone.php.bak epesi-clone/data/config.php
chmod -R a+rwX epesi-clone/data
echo mysql replicate
mysqldump -u username -ppassword --add-drop-table epesi | mysql -u username -ppassword epesi-clone
The first time you should setup your clone installation manually. Especially the database (epesi-clone) needs to be created and proper permissions setup as well.
Later - using this script - you can make clone automatically. We use Webmin on several servers for administration and you can set this up as a custom command.
Here is an overview of what this script does:
#!/bin/sh
cd /var/www
Change directory to your epesi installation directory (yours may be different). In our scenario both epesi installations - epesi and epesi-clone are directly under the /var/www:
/var/www/epesi
/var/www/epesi-clone
mv epesi-clone/data/config.php /tmp/config-epesi-clone.php.bak
We make a temp copy of the configuration file from epesi-clone - because this file will point to epesi-clone database. We don't want by accident to use the live database.
cp epesi-clone/data/Base_MainModuleIndicator/logo.gif /tmp/logo.gif.bak
As another indicator to the user - to differentiate between the
live and
clone version - we modify the logo (watermark clone or demo on top of the company logo is fine). Now we are making a copy of this logo to be restored later.
echo Remove clone
rm -R epesi-clone
Having a backup of 2 important files - config.php and the custom logo we remove all files recursively.
echo Clone live to clone
cp -R epesi epesi-clone
Now we are making an exact replica (clone) of the live epesi installation (-R - recursively of course).
mv -f /tmp/logo.gif.bak epesi-clone/data/Base_MainModuleIndicator/logo.gif
mv -f /tmp/config-epesi-clone.php.bak epesi-clone/data/config.php
We restore config file and logo moving it (mv) from /tmp directory
chmod -R a+rwX epesi-clone/data
Set proper permissions on data directory.
echo mysql replicate
mysqldump -u username -ppassword --add-drop-table epesi | mysql -u username -ppassword epesi-clone
Finally we copy the database from epesi to epesi-clone, removing all tables first.
If you can use rsync then the script can be modified as follows:
#!/bin/sh
cd /var/www
mv epesi-clone/data/config.php /tmp/config-clone.php.bak
cp epesi-clone/data/Base_MainModuleIndicator/logo.gif /tmp/logo.gif.bak
#echo Remove clone
#rm -R epesi-clone
echo Clone live to clone
rsync -a epesi/ epesi-clone
mv -f /tmp/logo.gif.bak epesi-clone/data/Base_MainModuleIndicator/logo.gif
mv -f /tmp/config-clone.php.bak epesi-clone/data/config.php
#chmod -R a+rwX epesi-clone/data
echo mysql replicate
mysqldump -u epesi -ppassword --add-drop-table epesi | mysql -u epesi -ppassword epesi-clone
The only difference is: rsync -a epesi/ epesi-clone
I hope this helps. It is fairly simple to modify this script to run on Windows server as well.