Code coverage for /20081101/modules/statistics/statistics.install

Line #Times calledCode
1
<?php
2
// $Id: statistics.install,v 1.13 2007/12/18 12:59:22 dries Exp $
3
4
/**
5
 * Implementation of hook_install().
6
 */
72
function statistics_install() {
8
  // Create tables.
92
  drupal_install_schema('statistics');
102
}
11
12
/**
13
 * Changes session ID  field to VARCHAR(64) to add support for SHA-1
hashes.
14
 */
152
function statistics_update_1000() {
160
  $ret = array();
17
180
  switch ($GLOBALS['db_type']) {
190
    case 'mysql':
200
    case 'mysqli':
210
      $ret[] = update_sql("ALTER TABLE {accesslog} CHANGE COLUMN sid sid
varchar(64) NOT NULL default ''");
220
      break;
230
    case 'pgsql':
240
      db_change_column($ret, 'accesslog', 'sid', 'sid', 'varchar(64)',
array('not null' => TRUE, 'default' => "''"));
250
      break;
260
  }
27
280
  return $ret;
290
}
30
31
/**
32
 * Implementation of hook_uninstall().
33
 */
342
function statistics_uninstall() {
35
  // Remove tables.
360
  drupal_uninstall_schema('statistics');
37
380
  variable_del('statistics_count_content_views');
390
  variable_del('statistics_enable_access_log');
400
  variable_del('statistics_flush_accesslog_timer');
410
  variable_del('statistics_day_timestamp');
420
  variable_del('statistics_block_top_day_num');
430
  variable_del('statistics_block_top_all_num');
440
  variable_del('statistics_block_top_last_num');
450
}
46
47
/**
48
 * Implementation of hook_schema().
49
 */
502
function statistics_schema() {
512
  $schema['accesslog'] = array(
522
    'description' => t('Stores site access information for statistics.'),
53
    'fields' => array(
54
      'aid' => array(
552
        'type' => 'serial',
562
        'not null' => TRUE,
572
        'description' => t('Primary Key: Unique accesslog ID.'),
582
      ),
59
      'sid' => array(
602
        'type' => 'varchar',
612
        'length' => 64,
622
        'not null' => TRUE,
632
        'default' => '',
642
        'description' => t('Browser session ID of user that visited
page.'),
652
      ),
66
      'title' => array(
672
        'type' => 'varchar',
682
        'length' => 255,
692
        'not null' => FALSE,
702
        'description' => t('Title of page visited.'),
712
      ),
72
      'path' => array(
732
        'type' => 'varchar',
742
        'length' => 255,
752
        'not null' => FALSE,
762
        'description' => t('Internal path to page visited (relative to
Drupal root.)'),
772
      ),
78
      'url' => array(
792
        'type' => 'varchar',
802
        'length' => 255,
812
        'not null' => FALSE,
822
        'description' => t('Referrer URI.'),
832
      ),
84
      'hostname' => array(
852
        'type' => 'varchar',
862
        'length' => 128,
872
        'not null' => FALSE,
882
        'description' => t('Hostname of user that visited the page.'),
892
      ),
90
      'uid' => array(
912
        'type' => 'int',
922
        'unsigned' => TRUE,
932
        'not null' => FALSE,
942
        'default' => 0,
952
        'description' => t('User {users}.uid that visited the page.'),
962
      ),
97
      'timer' => array(
982
        'type' => 'int',
992
        'unsigned' => TRUE,
1002
        'not null' => TRUE,
1012
        'default' => 0,
1022
        'description' => t('Time in milliseconds that the page took to
load.'),
1032
      ),
104
      'timestamp' => array(
1052
        'type' => 'int',
1062
        'unsigned' => TRUE,
1072
        'not null' => TRUE,
1082
        'default' => 0,
1092
        'description' => t('Timestamp of when the page was visited.'),
1102
      ),
1112
    ),
112
    'indexes' => array(
1132
      'accesslog_timestamp' => array('timestamp'),
1142
      'uid' => array('uid'),
1152
    ),
1162
    'primary key' => array('aid'),
117
  );
118
1192
  return $schema;
1200
}
121
1222