You are here

function statistics_counter_uninstall in Statistics Counter 8

Same name and namespace in other branches
  1. 7 statistics_counter.install \statistics_counter_uninstall()

Implements hook_uninstall().

File

./statistics_counter.install, line 61
Statistics Counter

Code

function statistics_counter_uninstall() {
  $db = Database::getConnection();
  $transaction = $db
    ->startTransaction();
  try {
    $schema = $db
      ->schema();
    $schema
      ->dropField('node_counter', 'weekcount');
    $schema
      ->dropField('node_counter', 'monthcount');
    $schema
      ->dropField('node_counter', 'yearcount');

    // Ignore slave server temporarily to give time for the
    // saved block to be propagated to the slave.
    // db_ignore_slave();
  } catch (\Exception $e) {
    $transaction
      ->rollback();
    watchdog_exception('php', $e);
    drupal_set_message(t('Cannot drop fields'), 'error');
  }
}