You are here

function calendar_uninstall in Calendar 6.2

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

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

File

./calendar.install, line 28

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) . "')");
  while ($row = db_fetch_array($result)) {
    db_query("DELETE FROM {views_view} WHERE vid = %d", $row['vid']);
    db_query("DELETE FROM {views_display} WHERE vid = %d", $row['vid']);
  }
  db_query("DELETE FROM {cache_views}");
  return $ret;
}