You are here

function library_uninstall in Library 6

Same name and namespace in other branches
  1. 5.2 library.install \library_uninstall()
  2. 6.2 library.install \library_uninstall()
  3. 7 library.install \library_uninstall()

Implementation of hook_uninstall().

File

./library.install, line 151
@author Jess Straatmann library.install Install and uninstall all required databases. Also do incremental database updates.

Code

function library_uninstall() {
  foreach (library_get_content_fields() as $fields) {
    foreach ($fields as $type) {
      foreach ($type as $field) {
        variable_del('library_display_field_' . $field['field_name']);
      }
    }
  }
  foreach (node_get_types() as $type => $info) {
    variable_del('library_' . $type . '_due_dates');
    variable_del('library_' . $type);
    foreach (library_actions() as $key => $value) {
      variable_del('library_days_for_' . $type . '_' . library_clean_action_name($value['name']));
      variable_del('library_hours_for_' . $type . '_' . library_clean_action_name($value['name']));
      variable_del('library_period_for_' . $type . '_' . library_clean_action_name($value['name']));
    }
  }
  variable_del('library_links_display_available');
  variable_del('library_links_display_unavailable');
  variable_del('library_links_display_reference');
  variable_del('library_item_barcodes');
  variable_del('library_unique_titles');
  variable_del('library_cron');
  variable_del('library_list_status_display');
  variable_del('library_status_display');
  variable_del('library_quantity_display');
  variable_del('library_taxonomy_display');
  variable_del('library_available_text');
  variable_del('library_reference_only_text');
  variable_del('library_unavailable_noduedates_text');
  variable_del('library_send_automatic_email');
  variable_del('library_mail_notify_overdue_subject');
  variable_del('library_mail_notify_overdue_body');
  drupal_uninstall_schema('library');

  // 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');
  drupal_set_message(t('Library module successfully uninstalled'));
}