humanmade / WPThumb

:warning: UNMAINTAINED :warning: On demand image resizing for WordPress
https://humanmade.co.uk/wpthumb/
170 stars 32 forks source link

wp_upload_dir is cached when using switch_to_blog #98

Closed joehoyle closed 10 years ago

joehoyle commented 10 years ago

Ran into an issue on a large multisite when switching between blogs. wp_upload_dir is cached for the whole script execution, which means switching between blogs or filtering the wp_upload_dir filter will not have an effect on WP Thumb.

We cache wpthumb for performance reasons as it is a rather slow function, however I think we might have to remove this as it's causing bugs.

danielbachhuber commented 10 years ago

What about clearing the cache when switch_to_blog() is used?

joehoyle commented 10 years ago

@danielbachhuber that would fix this specific case, but I think switch_to_blog is one of many ways upload_dir could change. Hooking upload_dir directly, or changing any of the site url / uploads url on the fly too.