You are here

function better_statistics_install in Better Statistics 6

Implements hook_install().

Adds fields provided by this module to the accesslog table.

File

./better_statistics.install, line 14
Install and uninstall functions for the Better Statistics module.

Code

function better_statistics_install() {

  // Load our field definitions.
  module_load_include('inc', 'better_statistics', 'better_statistics.helpers');
  $fields = _better_statistics_define_fields(TRUE);

  // For each field defined, add it to the accesslog.
  foreach ($fields as $name => $field) {
    $return[$name] = array();
    db_add_field($return[$name], 'accesslog', $name, $field);
  }

  // Update this module's weight to something below Statistics' weight.
  db_query("UPDATE {system} SET weight = -1 WHERE name = 'better_statistics'");
}