You are here

function magic_clear_cache in Magic 7.2

A helper function to clear the magic cache.

Parameters

mixed $theme (default: FALSE): The theme name, or FALSE to delete all caches.

array $types (default: array()): The type of caches to remove. May have an array keyed with 'css' or 'js' or leave empty to clear both.

1 call to magic_clear_cache()
magic_form_system_theme_settings_submit in includes/magic.settings.inc
Submit handler for the theme settings form.
1 string reference to 'magic_clear_cache'
magic_drush_cache_clear in includes/magic.drush.inc
Implements hook_drush_cache_clear().

File

./magic.module, line 214
Keep Frontend DRY; sprinkle it with MAGIC!

Code

function magic_clear_cache($theme = FALSE, $types = array()) {
  if ($theme) {

    // We are only clearing the cache for a specific theme, not all caches.
    if (empty($types) || $types['css'] == TRUE) {
      cache_clear_all("{$theme}:css:", 'cache_magic', TRUE);
    }
    if (empty($types) || $types['js'] == TRUE) {
      cache_clear_all("{$theme}:js:", 'cache_magic', TRUE);
    }
  }
  else {

    // No settings were passed, we will clear all caches.
    cache_clear_all(NULL, 'cache_magic');
  }
}