This will let contrib modules offload Ubercart hooks into .ubercart.inc files, reducing the size of .module files.

http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...

Comments

longwave’s picture

Status: Active » Needs review
StatusFileSize
new51.11 KB

As an example, the attached patch moves hook_uc_cart_pane() and subsequent functions into .uc_cart.inc files which are loaded on demand, reducing code weight in .module files as follows:

 .../uc_google_checkout/uc_google_checkout.module   |  237 ----------------
 .../uc_google_checkout.uc_cart.inc                 |  243 ++++++++++++++++
 payment/uc_paypal/uc_paypal.module                 |   85 ------
 payment/uc_paypal/uc_paypal.uc_cart.inc            |   86 ++++++
 shipping/uc_quote/uc_quote.module                  |  108 +-------
 shipping/uc_quote/uc_quote.uc_cart.inc             |  113 ++++++++
 uc_cart/uc_cart.module                             |  290 +-------------------
 uc_cart/uc_cart.uc_cart.inc                        |  285 +++++++++++++++++++
 8 files changed, 739 insertions(+), 708 deletions(-)

hook_uc_cart_pane() is only invoked from /cart and the cart pane admin pages, so this saves 708 lines of code from being loaded at all other times (if all four modules are enabled). Repeating this for other hooks should have similar benefits in reducing memory usage and also helps organise the code better.

In order to test this patch you must clear cache after applying it.

Status: Needs review » Needs work

The last submitted patch, 1153818-hook_hook_info-hook_uc_cart_pane.patch, failed testing.

longwave’s picture

Status: Needs work » Postponed

Not sure this is worth bothering with now.

longwave’s picture

Status: Postponed » Closed (won't fix)

Definitely not worth changing this now.