You are here

function advagg_remove_all_aggregated_files in Advanced CSS/JS Aggregation 7.2

Remove all files from the advagg CSS/JS directories.

Parameters

bool $kill_htaccess: Set to TRUE to remove the htaccess files as well.

Return value

array Array of all files removed.

2 calls to advagg_remove_all_aggregated_files()
advagg_admin_clear_all_files_button in ./advagg.admin.inc
Clear out all advagg aggregated files.
drush_advagg_clear_all_files in ./advagg.drush.inc
Callback function for drush advagg-clear-all-files.

File

./advagg.cache.inc, line 383
Advanced CSS/JS aggregation module.

Code

function advagg_remove_all_aggregated_files($kill_htaccess = FALSE) {
  $options = array(
    'callback' => 'file_unmanaged_delete',
    'nomask' => '/(\\.\\.?|CVS)$/',
  );
  list($css_files, $js_files) = advagg_get_all_files($options);

  // Let other modules know about the removed files.
  // Call hook_advagg_removed_aggregates().
  module_invoke_all('advagg_removed_aggregates', $css_files);
  module_invoke_all('advagg_removed_aggregates', $js_files);

  // Remove the htaccess files as well.
  if ($kill_htaccess) {
    list($css_path, $js_path) = advagg_get_root_files_dir();
    if (file_exists($css_path[0] . '/.htaccess')) {
      file_unmanaged_delete($css_path[0] . '/.htaccess');
      $css_files[] = $css_path[0] . '/.htaccess';
    }
    if (file_exists($js_path[0] . '/.htaccess')) {
      file_unmanaged_delete($js_path[0] . '/.htaccess');
      $js_files[] = $js_path[0] . '/.htaccess';
    }
  }
  return array(
    $css_files,
    $js_files,
  );
}