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.
Comment | File | Size | Author |
---|---|---|---|
#2 | 1890228-uc_order_can_delete.patch | 3.16 KB | longwave |
#1 | uc_order_can_delete_backport-1890228-1.patch | 1.53 KB | m.stenta |
Comments
Comment #1
m.stentaAttached 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.
Comment #2
longwaveUpdated 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().
Comment #3
m.stenta+1 Makes sense to me.
Comment #4
longwaveCommitted.