Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#3 | 540266_default_presets.patch | 6.64 KB | Island Usurper |
ubercart_imagecache.patch | 6.87 KB | ryan_courtnage | |
Comments
Comment #1
rszrama CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: 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 CreditAttribution: Island Usurper commentedComment #5
Island Usurper CreditAttribution: Island Usurper commentedCommitted. I'm so glad this fixes the weird duplicate preset issue that pops up every so often.