6

There is the Allow install profiles to be uninstalled issue that doesn't allow installation profiles to be uninstalled. Is there any way to do this in D7? (With a little more effort if necessary.)

When you install D7, you typically have to choose an install profile; this could be the "standard" profile shipped with Drupal core. Once installed, the install profile will sit in the "system" table forever, with no obvious way to disable it.

Is there some more hackish way to disable the install profile.

To harmonize the question with the accepted answer even more, I extend the question to: If the install profile cannot or should not be disabled, then can it be replaced at least?

7
  • How is your question different from drupal.stackexchange.com/questions/10730/… ?
    – beth
    Sep 4, 2013 at 17:56
  • the other question wants to remove the profiles as options on install. what i want is to disable an already installed install profile, and i don't care whether it is still available on install afterwards.
    – donquixote
    Sep 4, 2013 at 20:04
  • Do you want to uninstall the modules those come with the install profile, as well? or just disable the profile itself?
    – Elin Y.
    Sep 5, 2013 at 15:01
  • the initial motivation was to get rid of the dependencies of the install profile, e.g. overlay and toolbar modules. I then realized it is already possible to disable the dependencies without disabling the install profile. But it is still a legitimate thing to ask for.
    – donquixote
    Sep 5, 2013 at 17:07
  • "the modules those come with the install profile" what do you mean exactly? modules that are listed as dependencies in the install profile's info file? or are you talking about something else?
    – donquixote
    Sep 5, 2013 at 17:08

4 Answers 4

9
+50

In Drupal 7, a install profile is like a module, but a special one, with two major exceptions:

  • Any module required by a install profile can be disabled --as you have found-- except the ones required by drupal core (field, filter, node, system, user). See module_disable() function for details, where the dependency on the install profile is explicitly discarded.
  • The profile used to install a site is also a required module. This is hardcoded in drupal_required_modules().

So a profile can't be uninstalled, because it is a required module.

You can set status to 0 in system table, but you shouldn't, since:

  • Drupal expects the install profile to be enabled, and rely on that for some operations, none if them critical afaik.
  • it is a module, it may implement any hook (in its .profile file), or declare any function required by a profile's submodule. Disabling it the hard way may produce misfunction or a php fatal error in those scenarios.

Btw, the install profile used to install the site is stored in the install_profile variable

# drush vget install_profile
install_profile: 'minimal'

You can, if you find it useful for some reason, change the install profile by setting install_profile to any other profile name and enabling it in the system table.

3
  • Awesome! This is what I needed to hear. So the two things are the system table, and this variable (I hope that's all). And while I cannot or should not simply disable it (by hacking the db), I can replace it with something else.
    – donquixote
    Sep 6, 2013 at 19:21
  • ok, so if I replace it, then the replacement needs to live again in DRUPAL_ROOT . '/profiles/', right? Or could it be something in sites/all/modules? Afaik, Drupal will only scan profiles/ for install profiles. But maybe if it is already enabled, then it does not matter anymore?
    – donquixote
    Sep 6, 2013 at 19:27
  • It is not critical for normal site functioning, but it should be placed in /profiles/ since Drupal assumes that. Several functions use this hardcoded path, the main one, afaik, is install_profile_info().
    – jonhattan
    Sep 11, 2013 at 8:26
2

The Profile Switcher module for D7 may help: https://www.drupal.org/project/profile_switcher

1

Habitat module is your option and I'm not using this before. The specified modules are enabled and disabled based on a variable you set in settings.php

It provides settings to enable or disable certain modules on each environment (habitat). Just set a variable with e.g. $conf['habitat'] = 'local'; in your settings.php file (the actual variable to use there is configurable for your current workflow). The disabling/enabling modules is done on hook_init.

enter image description here

4
  • 1
    Sorry, I don't see how this relates to the original question.
    – donquixote
    Sep 11, 2013 at 8:49
  • Using this module you can disable the modules, see the screenshot
    – Bala
    Sep 11, 2013 at 8:57
  • yes, but would this also disable an install profile? the accepted answer by jonhattan shows that install profiles are not quite the same as regular modules. So you should at least mention how habitat deals with the specifities of install profiles.
    – donquixote
    Sep 11, 2013 at 9:47
  • I mention in my post I'm not using this before
    – Bala
    Sep 11, 2013 at 9:51
1

The following query would set the status of the install profile to 0 (disabled).

UPDATE `system` SET `status` = '0' WHERE `filename` = 'profiles/YOURPROFILE/YOURPROFILE.profile';

or

UPDATE `system` SET `status` = '0' WHERE `type` = 'module' AND `name` = 'YOURPROFILE';

or in an update script:

function YOUR_MODULE_update_7100(&$sandbox) {
  db_update('system')
    ->fields(array('status' => 0))
    ->condition('type', 'module')
    ->condition('name', 'YOURPROFILE')
    ->execute();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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