After updating to the 7.x-1.6 release I get the following error when trying to flush a style:
An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=4385260&op=do StatusText: Service unavailable (with message) ResponseText: Recoverable fatal error: Argument 1 passed to imagecache_coloractions_create_htaccess_for_style() must be of the type array, boolean given, called in /opt/git/acquia/d7/docroot/sites/all/modules/contrib/imagecache_actions/coloractions/imagecache_coloractions.module on line 184 and defined in imagecache_coloractions_create_htaccess_for_style() (line 29 of /opt/git/acquia/d7/docroot/sites/all/modules/contrib/imagecache_actions/coloractions/imagecache_coloractions.htaccess_creator.inc).
In our case all of our image styles are defined in Features and not in the database. This is what causes the issue.
In coloractions/imagecache_coloractions.module the call to image_style_load assumes there is an image style ID available to load an image style. When image styles are in Features, they do not have an ID, so the image style machine name should be used (and seems like the better call anyway).
function imagecache_coloractions_image_style_flush(array $style) {
// Error in core: the old style + set of effects is passed in. This means
// that when a convert effect is added or deleted we won't notice. So we
// "change" the order of execution by duplicating these lines from
// image_style_flush():
// Clear image style and effect caches.
cache_clear_all('image_styles', 'cache');
cache_clear_all('image_effects:', 'cache', TRUE);
drupal_static_reset('image_styles');
drupal_static_reset('image_effects');
// Now load the current state of our style.
$new_style = image_style_load(NULL, $style['isid']);
// Now back to our actual work: determine if we have to crate an .htaccess
// file.
include_once dirname(__FILE__) . '/imagecache_coloractions.htaccess_creator.inc';
imagecache_coloractions_create_htaccess_for_style($new_style);
}
Comment | File | Size | Author |
---|---|---|---|
imagecache_actions-flush-features-defined-styles.patch | 608 bytes | jaydub |
Comments
Comment #3
fietserwinThanks for reporting. Added some extra checks, see e.g. #2190759: hook_image_style_flush(): Prefer silent failure over clear failure.
Fixed and committed. I think this deserves a new release.