Remove Drupal Distro

Switching from an existing disto to vanilla Drupal
Tagged: DrupalTuesday, August 29, 2017

Removing a Drupal Profile/Distribution

Drupal distributions can save you time up front and get your project on the ground running. BUT that does come with a cost, you are now locked into relying on that profile to update their modules on a timely manner. I recently had a Drupal 7 website built with the Acquia Drupal. Shortly after launch there was a core security update, so I went to grab the latest Distribution download and couldn't find it. Turns out Acquia dropped support and removed the download from their site, basically locking me into Drupal 7.52.

Overview

Basically you will need to copy over the modules from the Distro to your sites/all modules folder, and modify the database to revert back to 'standard' Drupal. And rebuild the registry so the new module paths are updated.

  • Review the Profile/Distribution and find out what it installed (read the profile.install file)

    • It will most likely have added variables during the .install
  • Diff Check the Distro's modules to the vanilla modules you can download from Drupal.org hopefully the are a one-to-one match and you can just replace them. If not I would replace them anyways and hope for the best, otherwise you will have to make patches and maintain them forever!
  • Get the registry_rebuild module. (drush \@none dl registry_rebuild-7.x)
  • Once all the modules that existed in the Distro/Profile have been replaced with the vanilla ones, you can delete the profiles folder. (Your site will now be broken until you run registry_rebuild)

Removing the Drush

After the profile has been deleted, and the modules replaced with their standard counterparts your site will be broken. You will have to run the registry_rebuild function, but first I wanted to clean up the database and get rid of all the previous Disto/Profile entries.

I created the following Drush commands to specifically revert/remove what the Acquia Drupal acquia.install created.

// Run the following drush commands // Verify the install profile before we start drush php-eval "print 'Current install_profile is '. variable_get('install_profile');" // Remove variables created by the acquia.install drush php-eval "variable_del('acquia_identifier');" drush php-eval "variable_del('acquia_key');" drush php-eval "variable_del('acquia_welcome');" // Remove the path to the profile stored in the database drush php-eval "db_delete('system')->condition('filename ', 'profiles/acquia/acquia.profile')->execute();" // Start converting things to the standard Drupal 7 profile drush php-eval "variable_set('install_profile', 'standard');" drush php-eval "db_insert('system ')->fields(array('filename' => 'profiles/standard/standard.profile','name' => 'standard','type' => 'module','status' => 1,'bootstrap' => 0,'schema_version' => 0,'weight' => 1000,))->execute();" // Confirm the new 'standard' profile has been set drush php-eval "print 'Current install_profile is '. variable_get('install_profile');" // Run the registry_rebuild function to bring the site back online drush php-eval "registry_rebuild();" // or "drush rr" if you have that setup

Non-Drush method

If you don't want to use Drush or don't have it installed. You can take the same PHP code from the Drush commands above (everything inside the php-eval statements). And place the PHP code directly into a page or module or event at the bottom of the settings.php. Basically anywhere you can execute PHP code. I normally have a text format that that allows PHP and would just use that.