Currently, 6.x-2.0-rc3 uses hook_enable() to create required imagecache presets. This often results in mayhem for admins that first install UC and then later install imagecache (ie: the presets won't get created).

Rather than using hook_enable, we should be using hook_imagecache_default_presets(). The attached patch removes the preset code from hook_enable(), and moves it to hook_imagecache_default_presets(). The problem will disappear, and it will not matter what order the modules are installed. Affects uc_cart, uc_catalog, and uc_product.

Patch apples to 6.x-2.0-rc3.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rszrama’s picture

Oh, wow! Very interesting. I wonder if that hook existed when we first coded the integration. : P

(Gonna let Lyle have first dibs on a review since it's his domain. Does this affect imagefields at all?)

ryan_courtnage’s picture

Ha! I'm guessing it's a fairly new hook.

This doesn't affect imagefield. With this patch, Imagefield is still handed in hook_enable().

Island Usurper’s picture

For some reason, I couldn't get this to work right until I removed the call to imagecache_preset_actions() in uc_product_store_status(). I don't know why that shouldn't work, since ImageCache uses it to add the actions to the presets when they are loaded.

New patch includes that change, as well as some adjustments to the code style.

Island Usurper’s picture

Issue tags: +Release blocker
Island Usurper’s picture

Status: Needs review » Fixed

Committed. I'm so glad this fixes the weird duplicate preset issue that pops up every so often.

Status: Fixed » Closed (fixed)
Issue tags: -Release blocker

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