You are here

function webform_uninstall in Webform 5

Same name and namespace in other branches
  1. 8.5 webform.install \webform_uninstall()
  2. 5.2 webform.install \webform_uninstall()
  3. 6.3 webform.install \webform_uninstall()
  4. 6.2 webform.install \webform_uninstall()
  5. 7.4 webform.install \webform_uninstall()
  6. 7.3 webform.install \webform_uninstall()
  7. 6.x webform.install \webform_uninstall()

Implmentation of hook_uninstall

File

./webform.install, line 468

Code

function webform_uninstall() {
  watchdog("webform", "Removing webform module.");

  // Unset webform variables.
  variable_del('webform_use_cookies');
  variable_del('webform_debug');
  variable_del('webform_enable_fieldset');
  variable_del('webform_default_from_email');
  variable_del('webform_default_from_name');
  variable_del('webform_default_subject');
  if (!isset($component_list)) {
    $component_list = array();
    $path = drupal_get_path('module', 'webform') . "/components";
    $files = file_scan_directory($path, '^.*\\.inc$');
    foreach ($files as $filename => $file) {
      variable_del('webform_enable_' . $file->name, 1);
    }
  }

  // Delete uploaded files.
  $filepath = file_create_path('webform');
  _webform_recursive_delete($filepath);

  // Drop tables.
  db_query("DROP TABLE IF EXISTS {webform}");
  db_query("DROP TABLE IF EXISTS {webform_component}");
  db_query("DROP TABLE IF EXISTS {webform_submissions}");
  db_query("DROP TABLE IF EXISTS {webform_submitted_data}");

  // Clear the cache tables.
  cache_clear_all(null, 'cache');
  cache_clear_all(null, 'cache_filter');
  cache_clear_all(null, 'cache_menu');
  cache_clear_all(null, 'cache_page');
  watchdog("Webform", "Webform module removed.");
}