You are here

function advagg_uninstall in Advanced CSS/JS Aggregation 6

Same name and namespace in other branches
  1. 8.4 advagg.install \advagg_uninstall()
  2. 8.2 advagg.install \advagg_uninstall()
  3. 8.3 advagg.install \advagg_uninstall()
  4. 7.2 advagg.install \advagg_uninstall()
  5. 7 advagg.install \advagg_uninstall()

Implementation of hook_uninstall().

File

./advagg.install, line 60
Handles Advanced Aggregation installation and upgrade tasks.

Code

function advagg_uninstall() {

  // Make sure the advagg_get_root_files_dir function is available.
  drupal_load('module', 'advagg');

  // Remove files.
  list($css_path, $js_path) = advagg_get_root_files_dir();
  file_scan_directory($css_path, '.*', array(
    '.',
    '..',
    'CVS',
  ), 'file_delete', TRUE);
  @unlink($css_path);
  file_scan_directory($js_path, '.*', array(
    '.',
    '..',
    'CVS',
  ), 'file_delete', TRUE);
  @unlink($js_path);

  // Remove database tables.
  cache_clear_all('*', 'cache_advagg', TRUE);
  cache_clear_all('*', 'cache_advagg_files_data', TRUE);
  cache_clear_all('*', 'cache_advagg_bundle_reuse', TRUE);
  drupal_uninstall_schema('advagg');

  // Remove variables.
  variable_del('advagg_stale_file_last_used_threshold');
  variable_del('advagg_file_last_used_interval');
  variable_del('advagg_stale_file_threshold');
  variable_del('advagg_async_socket_connect');
  variable_del('advagg_css_render_function');
  variable_del('advagg_file_save_function');
  variable_del('advagg_js_render_function');
  variable_del('advagg_bundle_built_mode');
  variable_del('advagg_strict_js_bundles');
  variable_del('advagg_custom_files_dir');
  variable_del('advagg_gzip_compression');
  variable_del('advagg_async_generation');
  variable_del('advagg_rebuild_on_flush');
  variable_del('advagg_page_cache_mode');
  variable_del('advagg_socket_timeout');
  variable_del('advagg_aggregate_mode');
  variable_del('advagg_checksum_mode');
  variable_del('advagg_prune_on_cron');
  variable_del('advagg_dir_htaccess');
  variable_del('advagg_server_addr');
  variable_del('advagg_enabled');
  variable_del('advagg_closure');
  variable_del('advagg_debug');

  // Remove cache.inc variables.
  db_query("DELETE FROM {variable} WHERE name LIKE 'cache_flush_cache_advagg%'");
}