Mercurial > defr > drupal > core
comparison modules/statistics/statistics.install @ 1:c1f4ac30525a 6.0
Drupal 6.0
| author | Franck Deroche <webmaster@defr.org> |
|---|---|
| date | Tue, 23 Dec 2008 14:28:28 +0100 |
| parents | |
| children | 3edae6ecd6c6 |
comparison
equal
deleted
inserted
replaced
| 0:5a113a1c4740 | 1:c1f4ac30525a |
|---|---|
| 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 */ | |
| 7 function statistics_install() { | |
| 8 // Create tables. | |
| 9 drupal_install_schema('statistics'); | |
| 10 } | |
| 11 | |
| 12 /** | |
| 13 * Changes session ID field to VARCHAR(64) to add support for SHA-1 hashes. | |
| 14 */ | |
| 15 function statistics_update_1000() { | |
| 16 $ret = array(); | |
| 17 | |
| 18 switch ($GLOBALS['db_type']) { | |
| 19 case 'mysql': | |
| 20 case 'mysqli': | |
| 21 $ret[] = update_sql("ALTER TABLE {accesslog} CHANGE COLUMN sid sid varchar(64) NOT NULL default ''"); | |
| 22 break; | |
| 23 case 'pgsql': | |
| 24 db_change_column($ret, 'accesslog', 'sid', 'sid', 'varchar(64)', array('not null' => TRUE, 'default' => "''")); | |
| 25 break; | |
| 26 } | |
| 27 | |
| 28 return $ret; | |
| 29 } | |
| 30 | |
| 31 /** | |
| 32 * Implementation of hook_uninstall(). | |
| 33 */ | |
| 34 function statistics_uninstall() { | |
| 35 // Remove tables. | |
| 36 drupal_uninstall_schema('statistics'); | |
| 37 | |
| 38 variable_del('statistics_count_content_views'); | |
| 39 variable_del('statistics_enable_access_log'); | |
| 40 variable_del('statistics_flush_accesslog_timer'); | |
| 41 variable_del('statistics_day_timestamp'); | |
| 42 variable_del('statistics_block_top_day_num'); | |
| 43 variable_del('statistics_block_top_all_num'); | |
| 44 variable_del('statistics_block_top_last_num'); | |
| 45 } | |
| 46 | |
| 47 /** | |
| 48 * Implementation of hook_schema(). | |
| 49 */ | |
| 50 function statistics_schema() { | |
| 51 $schema['accesslog'] = array( | |
| 52 'description' => t('Stores site access information for statistics.'), | |
| 53 'fields' => array( | |
| 54 'aid' => array( | |
| 55 'type' => 'serial', | |
| 56 'not null' => TRUE, | |
| 57 'description' => t('Primary Key: Unique accesslog ID.'), | |
| 58 ), | |
| 59 'sid' => array( | |
| 60 'type' => 'varchar', | |
| 61 'length' => 64, | |
| 62 'not null' => TRUE, | |
| 63 'default' => '', | |
| 64 'description' => t('Browser session ID of user that visited page.'), | |
| 65 ), | |
| 66 'title' => array( | |
| 67 'type' => 'varchar', | |
| 68 'length' => 255, | |
| 69 'not null' => FALSE, | |
| 70 'description' => t('Title of page visited.'), | |
| 71 ), | |
| 72 'path' => array( | |
| 73 'type' => 'varchar', | |
| 74 'length' => 255, | |
| 75 'not null' => FALSE, | |
| 76 'description' => t('Internal path to page visited (relative to Drupal root.)'), | |
| 77 ), | |
| 78 'url' => array( | |
| 79 'type' => 'varchar', | |
| 80 'length' => 255, | |
| 81 'not null' => FALSE, | |
| 82 'description' => t('Referrer URI.'), | |
| 83 ), | |
| 84 'hostname' => array( | |
| 85 'type' => 'varchar', | |
| 86 'length' => 128, | |
| 87 'not null' => FALSE, | |
| 88 'description' => t('Hostname of user that visited the page.'), | |
| 89 ), | |
| 90 'uid' => array( | |
| 91 'type' => 'int', | |
| 92 'unsigned' => TRUE, | |
| 93 'not null' => FALSE, | |
| 94 'default' => 0, | |
| 95 'description' => t('User {users}.uid that visited the page.'), | |
| 96 ), | |
| 97 'timer' => array( | |
| 98 'type' => 'int', | |
| 99 'unsigned' => TRUE, | |
| 100 'not null' => TRUE, | |
| 101 'default' => 0, | |
| 102 'description' => t('Time in milliseconds that the page took to load.'), | |
| 103 ), | |
| 104 'timestamp' => array( | |
| 105 'type' => 'int', | |
| 106 'unsigned' => TRUE, | |
| 107 'not null' => TRUE, | |
| 108 'default' => 0, | |
| 109 'description' => t('Timestamp of when the page was visited.'), | |
| 110 ), | |
| 111 ), | |
| 112 'indexes' => array( | |
| 113 'accesslog_timestamp' => array('timestamp'), | |
| 114 'uid' => array('uid'), | |
| 115 ), | |
| 116 'primary key' => array('aid'), | |
| 117 ); | |
| 118 | |
| 119 return $schema; | |
| 120 } | |
| 121 |
