function statistics_counter_install in Statistics Counter 7
Same name and namespace in other branches
- 8 statistics_counter.install \statistics_counter_install()
Implements hook_install().
File
- ./
statistics_counter.install, line 35 - Statistics Counter
Code
function statistics_counter_install() {
$t = get_t();
$transaction = db_transaction();
try {
$schema = drupal_get_schema('node_counter');
db_add_field('node_counter', 'weekcount', $schema['fields']['weekcount']);
db_add_field('node_counter', 'monthcount', $schema['fields']['monthcount']);
db_add_field('node_counter', 'yearcount', $schema['fields']['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 create new fields'), 'error');
}
}