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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AaronBauman’s picture

Status: Active » Needs review
yched’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

bjaspan’s picture

It 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().

webchick’s picture

Installing modules is less rare than you think, particularly during installation. Barry, do you think it's worth explicitly stating this dependency in code comments..?

AaronBauman’s picture

Re #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?

Status: Fixed » Closed (fixed)

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