You are here

function file_style_flush in Styles 7

Flush cached file for a style.

Parameters

$style: An image style array.

1 call to file_style_flush()
file_style_save in contrib/file_styles/file_styles.module
Save a file style.

File

contrib/file_styles/file_styles.module, line 527
File widget formatter definitions.

Code

function file_style_flush($style) {
  $style_directory = drupal_realpath(variable_get('file_default_scheme', 'public') . '://styles/' . $style['name']);
  if (is_dir($style_directory)) {
    file_unmanaged_delete_recursive($style_directory);
  }

  // Let other modules update as necessary on flush.
  module_invoke_all('file_style_flush', $style);

  // Clear image style and effect caches.
  cache_clear_all('file_styles', 'cache');

  //   cache_clear_all('file_effects', 'cache');
  drupal_static_reset('file_styles');

  //   drupal_static_reset('file_effects');
  // Clear field caches so that formatters may be added for this style.
  field_info_cache_clear();
  drupal_theme_rebuild();

  // Clear page caches when flushing.
  if (module_exists('block')) {
    cache_clear_all('*', 'cache_block', TRUE);
  }
  cache_clear_all('*', 'cache_page', TRUE);
}