You are here

function calendar_systems_uninstall in Calendar Systems 6.2

Same name and namespace in other branches
  1. 8 calendar_systems.install \calendar_systems_uninstall()
  2. 6.3 calendar_systems.install \calendar_systems_uninstall()
  3. 6 calendar_systems.install \calendar_systems_uninstall()
  4. 7 calendar_systems.install \calendar_systems_uninstall()
  5. 7.2 calendar_systems.install \calendar_systems_uninstall()

Implements hook_uninstall().

Removes all available calendars settings from the variables table, also deleted all patch_manager.module nodes introduced by the Calendar Systems.

File

./calendar_systems.install, line 59
Implementation of Calendar Systems requirements and un/installation hooks.

Code

function calendar_systems_uninstall() {

  // Module API is not available at this point. Using
  // db_query() and LIKE is un-encouraged. So, load the API.
  drupal_load('module', 'calendar_systems');

  // Remove all calendars settings.
  $calendars = calendar_systems_calendars();
  foreach ($calendars as $identifer => $info) {
    variable_del('calendar_systems_settings_' . $identifier);
  }

  // Also wipe system's default calendar settings.
  variable_del('calendar_systems_default_calendar');

  // Include patch helpers.
  module_load_include('patch.inc', 'calendar_systems');

  // Say bye to patch_manager.module.
  _calendar_systems_patches_pm_delete();

  // Remind about those patches, if they're still applied.
  if (_calendar_systems_patches_applied()) {
    drupal_set_message(t('Since you just uninstalled the Calendar Systems, you might also want to reverse the applied patch(es).'));
  }
}