Topic: Need to be able to make a site copy

Hi,

I'd like to make a complete copy of a FA install - I've copied the database and the files - changed the database settings in config_db.php but I'm getting the error:

PHP Fatal error:  Class 'application' not found in /home/frontacc2/public_html/applications/customers.php on line 13

Any pointers gratefully received.

Re: Need to be able to make a site copy

To reply to my own post...

It needed a restart of Apache to enable the copy site to work without the error.

For reference here's my script which makes a copy of a site - I'll try to find somewhere on the wiki where it might be useful.

NB - The server runs Apache ITK so all files are owned by a single user.

#!/bin/bash

# copy_accounts_to_accounts2

# ----------------------------------------------------------------------------------
# This will take a copy of the live Open Atrium site and copy it to a training copy.
# ----------------------------------------------------------------------------------

# -------------------------------------------------------------------------------------------------
# Logging setup
# -------------------------------------------------------------------------------------------------

# These lines have been copied from http://stackoverflow.com/questions/3173131/redirect-copy-of-stdout-to-log-file-from-within-bash-script-itself
# and will send the script output to a log file.
##mkdir -p /var/backups/sbin
##mkdir -p ~/logs/pullpush
##DATE_TIME=`date +%Y%m%d-%H%M%S`
##logfile=~/logs/pullpush/pulldevfrombeta_${DATE_TIME}.log
##mkfifo ${logfile}.pipe
##tee < ${logfile}.pipe $logfile &
##exec &> ${logfile}.pipe
##rm ${logfile}.pipe

DATE_TIME=`date +%Y%m%d-%H%M%S`

# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo "Backup primary site..."
# -------------------------------------------------------------------------------------------------

# Here we will create backups which are datetime stamped to be able to go back to a previous 
# version if necessary.
mkdir -p /home/frontacc/backups
mysqldump frontacc > /home/frontacc/backups/${DATE_TIME}_frontacc.sql
tar --create --file=/home/frontacc/backups/${DATE_TIME}_frontacc.tar /home/frontacc/public_html

# Here we will make a backup to a standard location so that it is backed up by backup scripts.
mysqldump frontacc > /var/backups/frontacc.sql
tar --create --file=/var/backups/frontacc.tar /home/frontacc/public_html

# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo "Load the backup into the site..."
# -------------------------------------------------------------------------------------------------
mysqladmin --force drop frontacc2
mysqladmin create frontacc2

mysql frontacc2 < /var/backups/frontacc.sql

rm -r /home/frontacc2/public_html/*
tar -x --file=/var/backups/frontacc.tar --directory=/home/frontacc2/public_html --strip-components=3 

# We need to change ownership to openatriumcopy for the files just unzipped and need to change permissions
# on the files/ directory.
chown -R frontacc2:frontacc2 /home/frontacc2/public_html

# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo "Set up the settings.php file..."
# -------------------------------------------------------------------------------------------------
sed -i 's/Freeway Projects Limited/Freeway Projects Limited2/g' /home/frontacc2/public_html/config_db.php
sed -i 's/frontacc/frontacc2/g' /home/frontacc2/public_html/config_db.php
sed -i 's/firstsitepasswd/secondsitepassword/g' /home/frontacc2/public_html/config_db.php




# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo "Setting up the copy site with a different appearance from the live site..."
# -------------------------------------------------------------------------------------------------
## Todo


# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo "A restart of Apache is needed for the copy site to work..."
# -------------------------------------------------------------------------------------------------
apache2ctl restart


# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo "Finished"
# -------------------------------------------------------------------------------------------------