Follow-up to #1081266: Avoid re-scanning module directory when a filename or a module is missing
Problem/Motivation
To avoid performance deficit when multiple modules are missing. The deficit occurs because the "modules" directory is rescanned perpetually to look for missing modules on certain pages, such as admin/config.
Proposed resolution
We work around this by doing caching in #1081266: Avoid re-scanning module directory when a filename or a module is missing, but ideally we want this to be fixe the root cause as well, so we'd want to inform administrators about any missing modules:
What about adding a hook_requirements() check that looks for missing modules and gives you a link that you can click that will drop that module from the system?That is also a good place to place a bold red warning that you should never ever just remove a module without uninstalling it first. We're putting a huge amount of efforts into D8 to make uninstallation save and not leaving behind configuration and data and not being able to uninstall when a module is still used, just removing a module breaks all that. What if that module for example provides a bundle or a field type that is still used?
To be clear: it is a bug (sometimes extremely annoying), I've actually hit it a couple of times as well, but I disagree that we should fix this at run time. There are better, cleaner ways (order is my preference)
- hook_requirements() with a link to clean up
- running update.php
- when submitting the modules page
- maybe, maybe, maybe when clearing full caches, although that's maybe over the top
I'm in favor of number 1 because we then also have a UI that informs the user which module(s) are actually missing.
Remaining tasks
Write/review patch/tests
User interface changes
None.
API changes
None.
Comments
Comment #1
stefan.r CreditAttribution: stefan.r commentedComment #2
jeroen.b CreditAttribution: jeroen.b commentedIdea from @Berdir sounds good to me.
I think it shouldn't just be a link to clean up though.
In my opinion:
The page should provide a table with information about what modules are missing and what their location should be according to the system table.
The page should provide information on how to fix the missing records.
The page should provide check boxes for the missing records to only delete the records that you select.