If you use CiviCRM you know that moving a site is problematic. This is caused by CiviCRM storing vital information in a couple of configuration files, which are tedious and error-prone to fix by hand.
If you are using Joomla with CiviCRM there is a handy utility from Akeeba, Akeeba UNiTe to take unattended backups from a site, remotely or as a backup file, and restore it locally or at a staging site. But you will still have the problem above.
UNiTE
allows you to run a custom script after restoring the
site. Enter CiviCRM4JoomlaFixer
.
unite.yaml
is an example configuration for UNiTE
that you can
tweak for your situation. It will run the fixer script at the end of
the restore.
The script figures out most of the old and new values by itself from
the restored site. The only thing it cannot know is the URL to the
restored site. This has to be passed as an environment variable,
NEW_WEB_HOST
when executing the script and thus the unite
command:
NEW_WEB_HOST=<yournewhost> unite restore unite.yaml
The script will print all old and new values that it uses to fix the CiviCRM configuration files so that you can check that they will work.
I use devilbox to run
multiple local sites under separate subdomains under localhost
(actually a domain that always points back to 127.0.0.1 such as
localhost.tv
, dvl.to
or similar).
Then I have a script that uses the last part of the current directory
as the subdomain and creates a unite.yaml
with that. As I use the
domain name as dbname, dbuser, dbpassword in the database I can
completely automate a restore.
You can find that script in restore_to_devil_box.sh
.