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.
Comments
Comment #1
rszrama commentedOh, 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?)
Comment #2
ryan_courtnage commentedHa! I'm guessing it's a fairly new hook.
This doesn't affect imagefield. With this patch, Imagefield is still handed in hook_enable().
Comment #3
Island Usurper commentedFor 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.
Comment #4
Island Usurper commentedComment #5
Island Usurper commentedCommitted. I'm so glad this fixes the weird duplicate preset issue that pops up every so often.