You are here

function advagg_uninstall in Advanced CSS/JS Aggregation 7

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. 6 advagg.install \advagg_uninstall()
  5. 7.2 advagg.install \advagg_uninstall()

Implements hook_uninstall().

File

./advagg.install, line 65
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(
    'callback' => 'file_unmanaged_delete',
  ));
  @unlink($css_path);
  file_scan_directory($js_path, '/.*/', array(
    'callback' => 'file_unmanaged_delete',
  ));
  @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);

  // Remove variables.
  // TODO Please review the conversion of this statement to the D7 database API syntax.

  /* db_query("DELETE FROM {variable} WHERE name LIKE 'cache_flush_cache_advagg%'") */
  db_delete('variable')
    ->condition('name', 'advagg_%', 'LIKE')
    ->condition('name', 'cache_flush_cache_advagg%', 'LIKE')
    ->execute();
}