The uc_order_can_delete() function changed between the 6.x and 7.x branches. In the 6.x branch, it called uc_order_actions() in order to determine if the order could be deleted, which is terribly inefficient, and happens every time the order is edited. In 7.x, it calls user_access() to check permissions, as it should.

The patch that applied this change originally came from this issue: #736770: Replace Conditional Actions with Rules Integration

I don't know if there are other pieces of that patch that could be backported, but I would like to at least start with this one. Combined with certain modules that implement hook_order_actions(), the current 6.x version of uc_order_can_delete() can lead to very poor admin site performance. An example module that causes slowdowns is UC Order Followup, which performs a pretty hefty query to determine if followup email actions are available for an order.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m.stenta’s picture

Status: Active » Needs review
FileSize
1.53 KB

Attached is a patch that backports the changes in uc_order_can_delete() from the latest 7.x-3.x branch to the latest 6.x-2.x branch. I simply copied the function directly from the 7.x branch, and replaced the old one in 6.x.

longwave’s picture

Updated version of #1. hook_uc_order() in 7.x is hook_order() in 6.x, and we may as well reduce code duplication by switching uc_order_actions() to use uc_order_can_delete().

m.stenta’s picture

+1 Makes sense to me.

longwave’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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