You are here

function commerce_registration_defer_uninstall in Commerce Registration 7.2

Implements hook_uninstall().

File

modules/commerce_registration_defer/commerce_registration_defer.install, line 52
Schema and installation hooks for commerce_registration_defer module.

Code

function commerce_registration_defer_uninstall() {

  // Only remove the deferred state if there are no registrations that have that
  // state.
  if (db_query('SELECT 1 FROM {registration} r WHERE r.state = :state limit 0, 1', array(
    ':state' => 'deferred',
  ))
    ->fetchField()) {
    return;
  }

  // Remove deferred states.
  $deferred_states = array(
    'deferred',
  );
  db_delete('registration_state')
    ->condition('name', $deferred_states, 'IN')
    ->execute();
}