| Project: | Drupal Commerce |
| Version: | 7.x-1.x-dev |
| Component: | Other |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
| Issue tags: | kickstart blocker |
Issue Summary
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.
Comments
#1
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.
#2
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.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.