How to Remove a Drupal Install Profile

Recently I wanted to remove a profile from a Drupal 7 site - it contained a number of out of date modules.  Some of the modules had been updated, but they were stored in the sites/all/modules folder along with a number of additional modules.  This really made the site a bit messy, especially since I needed to do a core Drupal update as well.

I found this blog post - https://ohthehugemanatee.org/blog/2014/01/07/how-to-remove-a-drupal-inst...

Basically, the process is:

  1. Copy the files (modules/themes/libraries) from the profile directory to the appropriate sites/all folder.
  2. Check if the profile creates any system variables.  If so, update them.
  3. Change the system install_profile variable.
  4. Clear cache.
  5. Run the drush Registry Rebuild command.
  6. Clear cache.

Since I was removing our Nittany distribution, which is mothing more than a collection of modules, libraries and themes, I did not need to do Step 2.  However, after Step 6 I noticed an warning message on the module listing page.

"Notice: Undefined index: distribution_name in drupal_install_profile_distribution_name() (line 207 of /includes/install.inc)"

After a little investigation, I found that the status for the profiles in the system table was not being changed - there was a row for Nittany with status=1, i.e. enabled, but a status=0 for the standard profile.  I deleted the Nittany row - 

delete from `system` where filename like 'profiles/nittany/nittany.profile';

And updated the standard row - 

update `system` set status=1 where filename like 'profiles/standard/standard.profile';

After that, no warning message.

UPDATE:  Kevin Reynen (@kreynen on Twitter) also pointed out the Profile Switcher module which will also assist in changing profiles, but modules, libraries, and themes will still need to be moved by hand.