- Issue created by @quietone
- First commit to issue fork.
- Merge request !11126Issue #3499865: Deprecate the Ban module by adding lifecycle in info and group legacy to test → (Closed) created by annmarysruthy
- 🇮🇳India annmarysruthy
Tests failed as ban module is used in tests. Will work on these tests as part of https://www.drupal.org/project/drupal/issues/3488838 📌 Use a test module instead of Ban in dependency tests Active .
- 🇳🇿New Zealand quietone
@annmarysruthy, thanks for working to deprecate Ban. I have only glanced at the MR but it looks correct.
Instead of updating the list of remaining tasks in the a comment on the MR can you put in the Issue Summary instead. The issue summary is the first place that contributors go to in order to understand what needs to be done. And reviewers and committers like it up to date so they know what to is expected.
This issue is to be committed last in the task listed in the parent issue so I setting to 'Postponed' and I have updated the remaining tasks accordingly.
- Status changed to Needs review
about 1 month ago 9:17am 3 July 2025 - 🇺🇸United States smustgrave
Seems #1 create a project for https://www.drupal.org/project/ban → is still needed
Also who's taking over the module? They probably should make that project.
- 🇦🇺Australia mstrelan
Added a section to the docs - https://www.drupal.org/docs/core-modules-and-themes/deprecated-and-obsol... →
- 🇺🇸United States smustgrave
Yup, verified the module URL, believe this is good to go. Thanks @mstrelan for taking on this module in contrib.
- 🇬🇧United Kingdom catch
Adding a tag for release notes so we don't forget to mention it but agreed this just needs to be in a list.
I can't think of anything else and the MR looks good.
Committed/pushed to 11.x, thanks!
- 🇩🇰Denmark ressa Copenhagen
It's great with all the slimming down of Drupal core, easing the maintenance burden, so thanks for that.
I saw an issue the other day, about Forum module, and how to approach switching from core to contrib. I left this comment:
How to transition from using Drupal core Forum module to contrib version, and similar questions would be great to get documented.
So perhaps this issue could be turned into a documentation issue, and the result added to a fresh README file → ?
I would guess that the method should be something like this:
- Update to the latest version of Drupal core
- Delete the Drupal core Forum module
- Download the contrib version with Composer
- Rebuild caches, and possibly extra steps →
- Run
drush updatedb
[...]
From 💬 "Nothing to install, update or remove" how to install this module ? Active .
Now, seeing another core module getting deprecated today, it occurred to me that the process is probably more or less identical every time, so could it be considered to add the basic steps to transition from core to contrib in the README's of all these Drupal core modules (Forum, Tour, Ban, etc.) which have been retired, and are now contrib? It could also be a link to a doc page, outlining the required steps.
It could be added as a new item on the to-do list for Deprecate-issues, something like "Create README, include steps to transition from core to contrib."?
- 🇬🇧United Kingdom catch
@ressa there's already a Drupal.org documentation page with recommendations for every removed module https://www.drupal.org/docs/core-modules-and-themes/deprecated-and-obsolete → - this is also linked from the lifecycle link in the module's .info.yml which is used for deprecation/status messages. Each module has instructions for what to do (it's usually 'add a dependency on the contributed module' with a link to the project page, which then has the generic d.o instructions on how to add a contrib module.
- 🇩🇰Denmark ressa Copenhagen
Thanks for a fast reply. And yes, I know that the https://www.drupal.org/docs/core-modules-and-themes/deprecated-and-obsolete → page exists, but it merely lists the deprecated modules, it does not list the steps required to transition from using a core to a contrib module.
I quickly checked three deprecated modules, and as far as I can tell, they do not guide the user through the process:
- https://www.drupal.org/project/tour →
- https://www.drupal.org/project/ban →
- https://www.drupal.org/project/forum →
This is why I suggest that we either
- Add the steps in the README or doc page for each deprecated module
or - Create a universal doc page, or maybe a new section ("Switch to Contrib"?) on https://www.drupal.org/docs/core-modules-and-themes/deprecated-and-obsolete → and link to it from the README or doc page
Drupal can break down if you move a module, which is why I think having a recommended list of steps will help everyone complete this task in a more or less fail safe method.
Everyone here in this issue is an old Drupal hand, but for new users, moving a module, and getting a WSOD can be extremely unnerving, and I think we should help non-veteran users out as much as possible.
- 🇬🇧United Kingdom catch
@ressa the process for changing from a deprecated core module to a contrib module is the same as installing any contributed module, there's no extra process. Potentially we could document that this is the case at the top of https://www.drupal.org/docs/core-modules-and-themes/deprecated-and-obsolete → but there are no special steps at all.
- 🇩🇰Denmark ressa Copenhagen
Thanks for sticking with me :)
Going through the steps, emulating a person without deep Drupal knowledge, if I simply run
composer require drupal/forum
and rebuild caches, Drupal crashes and I get this error message:Fatal error: Cannot redeclare forum_help() (previously declared in /var/www/html/web/core/modules/forum/forum.module:33) in /var/www/html/web/modules/contrib/forum/forum.module on line 34
Also, the URL has changed to
/admin/flush?token=tFhchVRz3uMAVRIapVZ7fuuYGKleN2pAtd_NslMbFpI
.Of course, as Drupal veterans, you and me both know that Drupal core Forum module (
web/core/modules/forum
) needs to be deleted and caches rebuild. Let's simulate that the user also realizes this. If I delete the core module, I now get this error:The website encountered an unexpected error. Try again later.
Symfony\Component\DependencyInjection\Exception\LogicException: Service 'forum.uninstall_validator' for consumer 'config_import_subscriber' does not implement Drupal\Core\Extension\ModuleUninstallValidatorInterface. in Drupal\Core\DependencyInjection\Compiler\TaggedHandlersPass->processServiceCollectorPass() (line 184 of core/lib/Drupal/Core/DependencyInjection/Compiler/TaggedHandlersPass.php).
If I refresh, I get this error:
The website encountered an unexpected error. Try again later.
ReflectionException: Class "\Drupal\forum\Controller\ForumController" does not exist in ReflectionMethod->__construct() (line 135 of core/lib/Drupal/Core/Entity/EntityResolverManager.php).
... and if I refresh, it now repeats the first error message. Rebuilding caches makes no difference.
If I then use the settings.php method (item #4 "Rebuild caches, and possibly extra steps" in the suggested list of steps from comment #15) adding this:
$settings['class_loader_auto_detect'] = FALSE;
... and refresh, I get these final messages and errors:
All caches cleared.
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/Controller/ForumController.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/Controller/ForumController.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/Controller/ForumController.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/Controller/ForumController.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/Form/DeleteForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/ForumSettingsForm.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(/var/www/html/web/core/modules/forum/src/Controller/ForumController.php): Failed to open stream: No such file or directory in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
Error message
Warning: include(): Failed opening '/var/www/html/web/core/modules/forum/src/Controller/ForumController.php' for inclusion (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/share/php') in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).... and finally, it looks like contrib version of Forum is in use.
Perhaps you can check if you see something else?
- 🇬🇧United Kingdom catch
Of course, as Drupal veterans, you and me both know that Drupal core Forum module (web/core/modules/forum) needs to be deleted and caches rebuild.
It doesn't need to be deleted, just a cache rebuild is enough.
- 🇩🇰Denmark ressa Copenhagen
So you can fix it with a standard cache rebuild? A simple cache rebuild is not enough in my case ... I need to use the settings.php trick, as seen in my previous comment.
But why is it not necessary to delete the old core module? How can Drupal know which one to use? Does Drupal keep track internally, if a contrib version of a deprecated module is present, and then it intelligently uses that instead, and ignores the core copy? If yes, perhaps a sentence about that could be added in the introduction of https://www.drupal.org/docs/core-modules-and-themes/deprecated-and-obsolete → ?
- 🇩🇰Denmark ressa Copenhagen
You're right! I just tried again without deleting the deprecated core module, and it does look like the deprecated core Forum module is automatically hidden on the Extend page, as I theorized.
I do still need to use the settings.php trick, a simple cache rebuild is not enough -- the files from the core module are still used.
I verified this by editing web/core/modules/forum/src/Controller/ForumController.php and tweaking line 299 to this:
'title' => $this->t('Add new MY D10 CORE @node_type', [
Only after nuking caches via settings.php did it start using the contrib file.
Perhaps this could be the help text, and the recommended steps? In theory, the contrib version could get hook updates after the separation, so isn't it prudent to recommend running updates as well?
After you download the contrib version of a deprecated core module, Drupal will automatically use the contrib version going forward, and you do not need to delete the deprecated core module.
Typically, these steps should complete a switch from core to using the contrib version:
- Download the contrib version with Composer.
- Rebuild caches. A more thorough method may be needed → .
- Run
drush updatedb
, in case there have been updates.
- 🇬🇧United Kingdom catch
But why is it not necessary to delete the old core module?
It's because module discovery looks for modules in core/modules last after all the other possible places that modules can live.
- 🇩🇰Denmark ressa Copenhagen
Thanks for clarifying @catch, I looked for a documentation page about module discovery hierarchy and behaviour, but didn't find anything. It seems to be an undocumented feature:
By design, Drupal allows multiple copies of a module in different directory spaces (eg one in /core/modules, one in /modules, one in sites/all/modules).
However, if duplicate copies exist in the same space, this works too, though I assume this is by accident rather than by design. So for example if I have:
- sites/all/modules/foo
- sites/all/modules/contrib/foothen the first one is taken by Drupal, and the second one is simply ignored.
However, because this behaviour is undocumented, it effectively puts the codebase in an unstable state: a developer doesn't know which module is being used by Drupal without inspecting the system table.
From #2647388: Don't allow duplicate modules in the same directory space → .
I have added a new section "How to replace a deprecated core module with its contrib version" https://www.drupal.org/docs/core-modules-and-themes/deprecated-and-obsol... → trying to summarize the findings here, and steps required.
Though, thinking more about this, a user who does not clear caches via the settings.php trick may in fact still be using files from core/modules/forum, even if contrib/forum is downloaded. Perhaps checking on the Extend page if Forum module is listed or not under "Core" modules section could serve as a method of verification, since the module path cache have probably then been refreshed?
- 🇩🇰Denmark ressa Copenhagen
I created ✨ Support rebuild of all caches, including APCu, via the browser Active .