Problem/Motivation

Since Drupal 10.3, it has been possible to uninstall profiles as long as they don't contain any in-use dependencies.

If an install profile wants to customize the install experience only but then be uninstalled, it has no way to do that beyond adding an extra clean-up step where it uninstalls itself. This works, and is what Drupal CMS does, but it's hacky. (Either that, or the site builder needs to be knowledgable enough to run drush pmu profile_name, which is not very likely -- most folks don't necessarily know that profiles can be uninstalled.)

Proposed resolution

Support a keep_profile flag in the profile info file, which defaults to true to preserve the current behavior...but if set to false, the profile is automatically uninstalled (assuming it is valid to do so) as part of the install_finished install task.

API changes

Not sure if this should be part of our API, but if it is, then yes: there will be a new supported info file key for install profiles.

Release notes snippet

TBD

Issue fork drupal-3605551

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Issue summary: View changes

phenaproxima’s picture

Issue tags: +Needs tests

Needs tests, but pushed the change to see what breaks.

The tests that are needed:

  • Profiles do not get uninstalled by default.
  • A profile that opts into uninstallation, and has no in-use dependencies, is uninstalled.
  • A profile that opts into uninstall but does have in-use dependencies blows up with an exception.
phenaproxima’s picture

Status: Active » Needs review
Issue tags: -Needs tests

All necessary tests are written, I think this is ready for review.

nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

I think this is a nice idea and surprisingly simple.

Test coverage looks good.

Only question is where to document this.

I added a task here #3576425: [meta] Profile extension improvement plan since there doesn't seem to be a place to document these profile switches and figuring that out is it if scope for this issue.

CR looks good too!

gábor hojtsy’s picture

I think this is a logical addition for profiles that want to customize the installer. Also I like that the naming is consistent with keep_english which is an existing feature in core. Changes look nice.

catch’s picture

I think this is a good idea - bridges things until we're able to actually deprecate install profiles which is still some way away. Also as @nicxvan points out suprisingly easy to add.

I updated the CR to target 11.5 instead of 12.0.0

  • catch committed a05498a6 on 11.x
    feat: #3605551 Allow install profiles to be automatically uninstalled...

  • catch committed 3992c657 on main
    feat: #3605551 Allow install profiles to be automatically uninstalled...
catch’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Took another look through and I can't see a reason not to do this. We'll eventually replace all of install profiles with something else that can do similar things, but this is a good step in that direction.

Committed/pushed to main and 11.x, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.