How to switch Drupal distributions in an existing website

drupal logo

Drupal distributions provide site features and functions for a specific type of site as a single download containing Drupal core, modules, themes, and pre-defined configuration. They make it possible to quickly set up a complex, use-specific site in fewer steps than if installing and configuring all those elements individually.

Switching Drupal profiles in an existing website can be really hard to achieve, due to all the meta data and dependencies between modules, themes, features and other elements. We recently helped the Climate Change Resource Center switching its Drupal website from the Open Public distribution to a standard installation, and these were the steps we took to achieve  it:

  1. Create inventory of modules, themes and features that were needed in the system.
  2. Create a backup of the database.
  3. Disable all modules and features that were not needed in the system.
  4. Uninstall all those modules and features, to clean up the database from information that was not going to be needed.
  5. Install registry rebuild.
  6. Identify all required modules, features and themes, and copy them over to the regular sites/all/ locations.
  7. Execute this drush command:
    drush vset --exact -y install_profile standard
  8. Clear cache:
    drush cc all
  9. Delete the files of the distribution. In our case:
    rm -rf profiles/openpublic/
  10. Rebuild the Drupal registry:
    cd sites/all/modules/registry_rebuild/
    php registry_rebuild.php

I strongly recommend to execute these steps in a development environment to ensure that they work for you.

After you successfully do the switch, I strongly recommend to take a new database backup, and search for possible records of that distribution in the .sql file using the grep command. I found out that several cache tables store records pointing to the former distribution for few days, until cache actually expires, but you may find some references to that former distribution from modules and features. If that is the case, consider uninstalling and installing/reconfiguring those modules again.