What is the best procedure for reverting the CiviCRM, powered by Drupal 7, back to a previous backed up state, in case of database corruption, failed upgrades or other undesirable changes?


How to revert the CiviCRM to previous state:

  1. Put Drupal into maintenance mode
  2. Disable integration modules
  3. Replace civicrm.settings.php with backed up copy and check permissions
  4. Remove everything in <drupal_home>/sites/all/modules/civicrm and replace with backed up version and check permissions
  5. Drop civicrm database and import backup database

  6. Clear caches and empty <drupal_home>sites/default/files/civicrm/templates_c and check permissions

  7. Re-enable integration modules

  8. Log in, test and debug

Command Line Cheatsheet for Drush and MySQL, Regarding These Steps:

Maintenance mode: drush vset maintenance_mode 1

Disabling and Enabling CiviCRM Integration Modules:

drush pm-disable [integration_module] or drush pm-enable [integration_module]

Dropping, re-creating and importing a database in MySQL:

mysql -u [username] -p
use [database name];
DROP DATABASE [database];
source path/to/backup.sql;

Clear caches: drush cc all

Dealing with templates_c: rm <drupal_home>sites/default/files/civicrm/templates_c/*

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.