Closed (fixed)
Project:
ImageCache
Version:
6.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Jan 2007 at 21:25 UTC
Updated:
7 Mar 2007 at 22:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
RobRoy commentedWith D5's ease of programatic form submission, we need to have all functions with static caching have an optional $reset parameter to clear the static cache. I've run into this doing some D5 installation profiles work with taxonomy_get_tree() (see http://drupal.org/node/106015). Imagine something contrived like this:
- Build a view with some imagecache images (static presets are now set)
- Programmatically submit a preset and some images with drupal_execute()
- Build another view or whatever (the static cache is now out-of-date, we need to be able to call _imagecache_get_presets(TRUE) to reset it before we build this second view.
Comment #2
quicksketchCool, sounds like a plan. I had forgotten that such a situation could occur. Updated patch attached.
Comment #3
dopry commentedHow do you guys feel about taking it a step further like the attached patch and using drupal's cache support, and static caching... Updates the other load functions to take advantage of a modified _imagecache_get_presets...
Comment #4
quicksketchThis seems like a good idea overall. Most pages I use 2-4 presets during a single request! Knocking them down to one would be awesome. Combining with the cache table should yield a small performance gain also.
I don't quite understand this part of the patch however:
Why call cache_get('imagecache:presets') twice in a row?
Comment #5
dopry commentedThat was an oversight. Try the attached patch.
Comment #6
quicksketchHere's a completely functional version of dopry's patch. There's a couple changes:
- cache_get and set serialize the data before caching
- the preset cache only uses the numeric ids as keys, rather than both names and ids as keys
- adds 'content_clear_type_cache()' which clears the views formatters
I noticed whenever I made a new preset in imagecache, I needed to empty the drupal cache (via devel) in order for the new preset to show up as a formatter in views. The content_clear_type_cache() empties the cache of content types and in turn causes all views formatters to be cleared.
I tested a couple times over and should be good for review.
Comment #7
quicksketchOh... and the patch.
Comment #8
dopry commentedcommitted to 4.7 dev and 5.0 dev.
Comment #9
dopry commentedcommitted to 4.7 dev and 5.0 dev.
Comment #10
quicksketchThanks dopry, this kicks serious ass. :D
Comment #11
kkaefer commentedI’m getting
Fatal error: Call to undefined function content_clear_type_cache()when I go to the administration page. Obviously, this function is a CCK function and not in Drupal core. However, CCK is not required for this module, is it?Comment #12
quicksketchOops, right you are. Here's an inline patch for Drupal 5:
If applied to the Drupal 4.7 branch, be sure to use 'module_exist' instead of 'module_exists';
Comment #13
quicksketchSetting to review, this still needs to go in.
Comment #14
quicksketchCommited content_clear_type_cache() fix to 4.7 and 5.x branches.
Comment #15
bjaspan commentedYou forgot to follow your own advice in #12: "If applied to the Drupal 4.7 branch, be sure to use 'module_exist' instead of 'module_exists'." Now, imagecache causes a fatal error on 4.7.
Comment #16
quicksketchThanks bjaspan. I've corrected this in the 4.7.x branch.
Comment #17
(not verified) commented