Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Since field_modules_installed()
and field_modules_enabled()
are invoked one after another, and since field_modules_enabled()
is always called when field_modules_installed
is called, there's no reason to call field_cache_clear
in both functions.
In other words, it's impossible to install a module without enabling it, so field_cache_clear
always gets called twice on module install, which seems unnecessary.
Comment | File | Size | Author |
---|---|---|---|
field_module-remove_field_modules_installed.patch | 614 bytes | AaronBauman | |
Comments
Comment #1
AaronBaumanComment #2
yched CreditAttribution: yched commentedLooks good.
Comment #3
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #4
bjaspan CreditAttribution: bjaspan commentedIt also does not cost anything to clear a cache twice in a row during a very rare event. I personally would have left this in because now we have an invisible, unstated dependency between _installed() and _enabled().
Comment #5
webchickInstalling modules is less rare than you think, particularly during installation. Barry, do you think it's worth explicitly stating this dependency in code comments..?
Comment #6
AaronBaumanRe #4: I don't understand what you mean by "invisible, unstated dependency between _installed() and _enabled()".
hook_modules_enabled is always run when a module is installed,
hook_modules_installed is only run when a module is installed for the first time.
Can you explain more explicitly?
Would your concern addressed by #836748: Improve documentation about install/enable/etc. hook invocation order?