You are here

function paypal_donate_uninstall in Paypal Donation 7

Same name and namespace in other branches
  1. 6 paypal_donate.install \paypal_donate_uninstall()

This hook is triggered when the paypal donate module is being uninstalled. This function will run only once and gives us the possibility to remove the a required table in the database.

@since 1.0

Return value

void

1 call to paypal_donate_uninstall()
paypal_donate_install in ./paypal_donate.install
This hook is triggered when the paypal donate module is being installed. This function will run only once and gives us the possibility to install the a required table in the database.

File

./paypal_donate.install, line 118
Install, update and uninstall functions for the paypal_donate module.

Code

function paypal_donate_uninstall() {
  $sql = 'SELECT nid FROM {node} n WHERE n.type = :type';
  $result = db_query($sql, array(
    ':type' => 'paypal_donate',
  ));
  $nids = array();
  foreach ($result as $row) {
    $nids[] = $row->nid;
  }
  node_delete_multiple($nids);
  foreach (array_keys(_paypal_donate_installed_fields()) as $field) {
    field_delete_field($field);
  }
  $instances = field_info_instances('node', 'paypal_donate');
  foreach ($instances as $instance_name => $instance) {
    field_delete_instance($instance);
  }
  node_type_delete('paypal_donate');
  field_purge_batch(1000);
}