You are here

function calendar_uninstall in Calendar 7

Same name and namespace in other branches
  1. 5.2 calendar.install \calendar_uninstall()
  2. 5 calendar.install \calendar_uninstall()
  3. 6.2 calendar.install \calendar_uninstall()
  4. 7.2 calendar.install \calendar_uninstall()

Implementation of hook_uninstall(). Remove all traces of calendars.

File

./calendar.install, line 29
Install, update and uninstall functions for the calendar module.

Code

function calendar_uninstall() {
  $ret = array();
  variable_del('calendar_default_view_options');
  $displays = array(
    'calendar',
    'calendar_attachment',
    'calendar_year',
    'calendar_day',
    'calendar_month',
    'calendar_week',
    'calendar_block',
    'calendar_block_view',
    'calendar_ical',
  );
  $result = db_query("SELECT DISTINCT vid FROM {views_display} WHERE display_plugin IN ('" . implode("','", $displays) . "')");
  foreach ($result as $row) {
    db_delete('views_view')
      ->condition('vid', $row->vid)
      ->execute();
    db_delete('views_display')
      ->condition('vid', $row->vid)
      ->execute();
  }
  db_delete('cache_views')
    ->execute();
  return $ret;
}