You are here

function widgets_set_flush in Widgets 7

Flush cached media for a set.

Parameters

$set: An widget set array.

5 calls to widgets_set_flush()
widgets_default_set_revert in ./widgets.module
Revert the changes made by users to a default widget set.
widgets_element_delete in ./widgets.module
Delete an widget element.
widgets_element_save in ./widgets.module
Save an widget element.
widgets_set_delete in ./widgets.module
Delete an widget set.
widgets_set_save in ./widgets.module
Save an widget set.

File

./widgets.module, line 646
Exposes global functionality for creating widget sets.

Code

function widgets_set_flush($set) {
  $set_directory = drupal_realpath(file_default_scheme() . '://sets/' . $set['name']);
  if (is_dir($set_directory)) {
    file_unmanaged_delete_recursive($set_directory);
  }

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

  // Clear widget set and widget caches.
  cache_clear_all('widgets_sets', 'cache');
  cache_clear_all('widgets_elements:', 'cache', TRUE);
  drupal_static_reset('widgets_sets');
  drupal_static_reset('widgets_elements');

  // Clear field caches so that formatters may be added for this set.
  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);
}