If a module provides a hook for declaring a new "component" (bundle, plugin, etc), then it needs to have a hook_modules_enabled() implementation that clears the static caches for those components, if a module providing a new component has been enabled.
Examples: search_api_modules_enabled(), rules_modules_enabled(), ctools_modules_enabled(), etc.
Even commerce_payment_modules_enabled() follows this convention.

For example, we have hook_commerce_customer_profile_type_info(). Shipping uses it to provide a "shipping" customer profile type.
But since commerce_customer_modules_enabled() doesn't clear the commerce_customer_profile_types static, calling commerce_customer_profile_types() before a page reload gives you an array with only "billing".
This breaks drush site-install in many cases, because it installs all modules in one go (no reloads).

As far as I can see, the problem exists in: customer, order, line_item, product submodules.

#1 1715436-reset-statics.patch2.46 KBbojanz
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es). View


bojanz’s picture

Status: Active » Needs review
Issue tags: +kickstart blocker
2.46 KB
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es). View

Turns out line_item did clear its statics. Applied the same pattern to customer and product, and added a clear for order states and statuses.

rszrama’s picture

Status: Needs review » Fixed

I went ahead and added a commerce_payment_methods_reset() function and used it. Our payment transaction entity type uses payment methods for bundles, so it deserved to be cleared and reset as well.

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