Problem/Motivation

We don't have a formal way to deprecate modules in core. In #3062281: Deprecate block_place module for removal in Drupal 9, we deprecated the Place Block module by deprecating basically everything inside it, including the .module file itself. The module had already been hidden in a previous minor release. It was a bit tedious and ad-hoc, and took a long time to implement even though we were deprecating a module that had been already hidden for many releases.

This issue is not for defining the conditions under which a module will be deprecated; that's a separate product management discussion. Rather, it's for discussing how to deprecate a module once the decision has been made to do so.

Proposed resolution

Use the lifecycle property in the info.yml of the module to deprecate and eventually remove the module from Drupal core. To deprecate a module change the lifecycle property to lifecycle: deprecated and add lifecycle_link: link to CR, In the next major release change the lifecycle property to lifecycle: obsolete and add lifecycle_link: link to CR. Also add an update to uninstall the module.

There are two possible scenarios:

  1. The module is being moved to contrib for future major versions
  2. The module has no replacement because its functionality has been moved into other modules or APIs (Example: #3111645: Uninstall entity_reference module and prevent it being enabled again, remove deprecated code)

What happens as a result will depend on which of these scenarios are the case.

  • There should be a requirements warning for both install and runtime.
  • If the module is not being moved to contrib, its APIs should be deprecated.
  • If a contrib replacement is being created, the Composer façade should somehow be able to resolve the core module versus the contrib module (whether based on version, project sub-namespacing, or some other mechanism) and the messaging should explain the correct actions to take.
  • Modules that have the deprecated module as a dependency should also receive a warning.
  • Composer projects that declare a dependency on the module should also receive a deprecation warning and recommend the replacement.
  • Automated tooling like Upgrade Status should detect and warn the user about the deprecated module.

Remaining tasks

  1. #3188544: [policy discussion] Address Composer namespacing issues when extensions move between core and contrib
  2. Can rector or Project Update Bot do anything with this, e.g. replace a dependency on a deprecated extension with its replacement or contrib equivalent?
  3. Done. Update Drupal deprecation policy to include modules and themes.

Completed child issues

  1. #3124762: Add 'lifecycle' key to .info.yml files
  2. #3215043: Indicate the non-stable statuses in admin/modules page
  3. #3250585: Highlight deprecated modules and themes at admin/reports/status page, providing warning and link with explanation
  4. #3223453: Check for uses of deprecated and obsolete projects based on the lifecycle info file key
  5. #3257127: Trigger a deprecation message when a deprecated module or theme is enabled
  6. #3215044: Promote the non-stable statuses in admin/appearance page, optionally even visually
  7. #3258782: Do not display obsolete modules at admin/modules
  8. #3265362: Do not display obsolete themes at admin/appearance

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

Comments

xjm created an issue. See original summary.

catch’s picture

I think this is a duplicate of #3124762: Add 'lifecycle' key to .info.yml files.

xjm’s picture

Title: [policy and patch] Provide a proper mechanism for deprecating modules » [policy and meta] Provide a proper mechanism for deprecating modules
Category: Feature request » Plan

The one bullet might be a duplicate, but there's more than just the feature to solve. Converting to a meta and maybe that's a child isse.

rpsu’s picture

Yup, it is not just about status key (should that be the way), but also

  • runtime notice?
  • status page warning?
  • making core modules NOT to enable all modules based on the core/modules -folder contents for their tests (several core modules it this way)
  • and fully related to the previous bullet provide a mechanism for core (all?) modules to turn on "all modules" taking into account their statuses in any way possible (currently only hidden: true or experimental: true would be possible filter?)
xjm’s picture

We also need to better solve the mechanics of moving the module into contrib, and the upgrade path for it.

We previously had the notion that we could have both the core module and the contrib one together on the same site and the contrib one would take precedence, which works for sites that are not managed with composer. If the site is managed with composer, however, it breaks because of the namespace issue.

rpsu’s picture

would it be possible to rename core-modules with some other pattern? Or does it break too many things such as all tests or something like that?

I am thinking another pattern such as drupal/quickedit => drupal/core-quickedit etc. so that overlapping names would not overlap by name.

This would probably have severe consequences, which would possibly be too big to take this approach.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

catch’s picture

xjm’s picture

xjm’s picture

Issue summary: View changes

Updating the IS a bit. We agreed that the APIs should only be deprecated if they won't exist with the same namespace in contrib as this caused us problems in D9. Also added some of the Composer-related considerations.

xjm’s picture

Issue summary: View changes
dww’s picture

#3124762: Add 'lifecycle' key to .info.yml files is getting pretty far along for just the status key itself. It's also starting to deal with some of the other points that this summary does. I'd love some feedback on the desired scope for #3124762, and which parts should be split off into other child issues of this plan.

Thanks!
-Derek

gábor hojtsy’s picture

@dww: I posted this on the committer meeting and @catch posted feedback at #3124762: Add 'lifecycle' key to .info.yml files about scope just now.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

xjm’s picture

Issue summary: View changes

Updating the IS with some of the child issues.

xjm’s picture

Issue summary: View changes
catch’s picture

Title: [policy and meta] Provide a proper mechanism for deprecating modules » [policy and meta] Provide a proper mechanism for deprecating extensions
catch’s picture

Title: [policy and meta] Provide a proper mechanism for deprecating extensions » [policy and meta] Provide a proper mechanism for deprecating modules and themes

Let's leave profiles out of this for now, that's its own massive set of problems.

xjm’s picture

Issue summary: View changes

Adding missing bullets re: tooling for the deprecated and obsolete statuses.

xjm’s picture

Issue summary: View changes
catch’s picture

Issue summary: View changes
gábor hojtsy’s picture

Issue summary: View changes

Updating issue summary with missing upgrade status issue that is already done for some time and marking one done.

quietone’s picture

Issue summary: View changes

Updated the proposed resolution to include the use of the lifecycle property.

quietone’s picture

What needs to happen so that a section on how to deprecate modules can be added to the deprecation policy?

quietone’s picture

Issue summary: View changes

Add two issues to the remaining tasks because installing an obsolete module from the UI results in a fatal error and installing an obsolete works when it shouldn't.

Moved completed child issues to the complete section so there is one list of completed.

quietone’s picture

Issue summary: View changes
quietone’s picture

Issue summary: View changes

Add task to update the Deprecation policy page.

quietone’s picture

Issue summary: View changes

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue summary: View changes

All the child issues but one have been fixed. Typically, an meta issue can be closed when that happens but there is one remaining question.

Can rector or Project Update Bot do anything with this, e.g. replace a dependency on a deprecated extension with its replacement or contrib equivalent?

liam morland’s picture

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

quietone’s picture

Status: Active » Reviewed & tested by the community

The question I asked in #37 I also asked in Slack and the answer was that that can be discussed in #3188544: [policy discussion] Address Composer namespacing issues when extensions move between core and contrib. That is the last remaining child issue here, so that is covered.

The documentation has been created and has been improved several times already.

I don't see any else that needs to be done in this issue. I've updated credit.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Yes everything except for the namespacing problem (which still catches me out based on the direction) is covered and standardised now. Closing out.

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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.