You are here

function appointment_calendar_uninstall in Appointment Calendar 7

Same name and namespace in other branches
  1. 8 appointment_calendar.install \appointment_calendar_uninstall()

Implements hook_unistall().

File

./appointment_calendar.install, line 109
Install and uninstall functions for the Appointment Calendar module.

Code

function appointment_calendar_uninstall() {
  $ournewtype = 'appointment_calendar';
  $sql = 'SELECT nid FROM {node} n WHERE n.type = :type';
  $result = db_query($sql, array(
    ':type' => $ournewtype,
  ));
  $nodeids = array();
  foreach ($result as $row) {
    $nodeids[] = $row->nid;
  }
  node_delete_multiple($nodeids);
  appointment_calendar_delete_custom_fields();
  node_type_delete($ournewtype);
  field_purge_batch(500);

  // Unlink file.
  appointment_calendar_delete_template_page();
}