Follow-up to #2632084: Improve performance of commerce_order_ui_menu()

Instead of rebuilding and calling all the module implements hooks to build up something that doesn't change often(the states and statuses). Store the build up in a permanent cached item.

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new1.6 KB
joelpittet’s picture

Title: Add permenant cache to store commerce_order_states. » Add permenant cache to store commerce_order_states()
joelpittet’s picture

Title: Add permenant cache to store commerce_order_states() » Add permanent cache to store commerce_order_states()
rszrama’s picture

Status: Needs review » Needs work
StatusFileSize
new1.88 KB

I touched this up a little, because #2 wouldn't have set the static cache if the order states array was found in the Drupal cache. However, as I was thinking it over, I realized this really needs to be language specific. Otherwise states won't be translated properly. This should work much the same way our cache implementation works for currencies.

joelpittet’s picture

Hope nobody is using #2 it caused me some grief this morning. Hiding it. #5 doesn't seem to have the same bug.

joelpittet’s picture

I'm running into an issue with #5 too where the address checkout page is going blank... gotta sort out what's going on.

joelpittet’s picture

This is the diff in the stored cache serialized array:

             [title] => Checkout
             [description] => Orders in this state have begun but not completed the checkout process.
             [weight] => -3
-            [default_status] => checkout_checkout
+            [default_status] => checkout_cart
             [checkout_complete] => 1
         )
joelpittet’s picture

Ah that seems to be my fault... I had some weird hook_commerce_checkout_page_info_alter() that was adding checkout_cart. Probably because I thought they were something else.

torgospizza’s picture

Status: Needs work » Needs review

Seems like low-hanging fruit, setting back to NR.