Friday, December 16, 2011

My current sites/all/modules

My current "modules" folder and what it contains:

  • civicrm
  • contrib
  • custom
  • shortsitename_features
I kind of like that.  Nice and sweet.  There's a bunch of modules under "contrib" of course, a few under custom (but growing) and a few under shortsitename_features  (but growing).

Tuesday, December 13, 2011

CiviCRM - moving your configuration changes to a different environment

I love code driven development.  So when I build my Drupal sites, I immediately download and enable Features.  I do not want to handle website settings between environments by comparing screens and clicking box after box.  When you are running in a local DEV environment, plus you have a TEST and LIVE environment, using Features saves time (which of course equals money).

So I started a new project using CiviCRM and the thought in the back of my mind for awhile was:

"I just changed a CiviCRM setting.  How do I migrate that change to my TEST and LIVE environments?".  

Well the time came and I had to do it.  I needed to get my TEST site going and didn't want to bother remembering all of the settings I needed to configure.

Luckily, CiviCRM comes with migrate scripts to Export and Import your settings.

First Export it from the localhost (DEV environment) using one of the options.  More exist, but these are pretty basic:

  1. Browse to
    1.  http://localhost/virtual_dir/sites/all/modules/civicrm/bin/migrate/export.php?name=&pass=&key=
      1. This will download a file called CustomGroupData.xml
  2. Using wget (if you want to script this and update the file at 3pm for example)
    1. wget -O D:\dev\htdocs\virtual_dir\sites\default\CiviCRM.info "http://localhost/virtual_dir/sites/all/modules/civicrm/bin/migrate/export.php?name=&pass=&key="


I save this file to a folder in the website I am working on.  Then, if it has changed, I commit it to git.

After the export file has been committed to git, then moved to your next server, import:
http://example.com/sites/all/modules/civicrm/bin/migrate/import.php?name=&pass=&key=&file=../../../../../default/CiviCRM.info


Notice the difference between this command and previous ones is that it uses import.php and specifies a file.

I noticed there were a couple of settings that did not get exported and I think those are related to CiviCRM Profiles.  I need to look into this a bit and see if this is an issue or "works as designed".

What are some other options for moving CiviCRM configuration changes between environments?