| 1 |
<?php |
<?php |
| 2 |
// $Id: click.install,v 1.2 2006/10/17 03:21:01 kbahey Exp $ |
// $Id$ |
| 3 |
|
|
| 4 |
|
/** |
| 5 |
|
* Implementation of hook_install(). |
| 6 |
|
*/ |
| 7 |
function click_install() { |
function click_install() { |
| 8 |
switch ($GLOBALS['db_type']) { |
// Create tables. |
| 9 |
case 'mysql': |
drupal_install_schema('click'); |
|
case 'mysqli': |
|
|
$query = db_query("CREATE TABLE {clicks} ( |
|
|
gid int(2) NOT NULL default '0', |
|
|
nid int(10) NOT NULL default '0', |
|
|
day_clicks int(10) NOT NULL default '0', |
|
|
week_clicks int(10) NOT NULL default '0', |
|
|
total_clicks int(10) NOT NULL default '0', |
|
|
start int(10) NOT NULL default '0', |
|
|
last int(10) NOT NULL default '0', |
|
|
PRIMARY KEY (gid, nid) |
|
|
) /*!40100 DEFAULT CHARACTER SET utf8 */;"); |
|
|
break; |
|
|
case 'pgsql': |
|
|
break; |
|
|
} |
|
| 10 |
} |
} |
| 11 |
|
|
| 12 |
function click_update_1() { |
/** |
| 13 |
return _system_update_utf8(array('clicks')); |
* Implementation of hook_schema(). |
| 14 |
|
*/ |
| 15 |
|
function click_schema() { |
| 16 |
|
$schema['clicks'] = array( |
| 17 |
|
'fields' => array( |
| 18 |
|
'gid' => array( |
| 19 |
|
'type' => 'int', |
| 20 |
|
'unsigned' => TRUE, |
| 21 |
|
'not null' => TRUE, |
| 22 |
|
'default' => 0), |
| 23 |
|
'nid' => array( |
| 24 |
|
'type' => 'int', |
| 25 |
|
'unsigned' => TRUE, |
| 26 |
|
'not null' => TRUE, |
| 27 |
|
'default' => 0), |
| 28 |
|
'day_clicks' => array( |
| 29 |
|
'type' => 'int', |
| 30 |
|
'unsigned' => TRUE, |
| 31 |
|
'not null' => TRUE, |
| 32 |
|
'default' => 0), |
| 33 |
|
'week_clicks' => array( |
| 34 |
|
'type' => 'int', |
| 35 |
|
'unsigned' => TRUE, |
| 36 |
|
'not null' => TRUE, |
| 37 |
|
'default' => 0), |
| 38 |
|
'total_clicks' => array( |
| 39 |
|
'type' => 'int', |
| 40 |
|
'unsigned' => TRUE, |
| 41 |
|
'not null' => TRUE, |
| 42 |
|
'default' => 0), |
| 43 |
|
'start' => array( |
| 44 |
|
'type' => 'int', |
| 45 |
|
'unsigned' => TRUE, |
| 46 |
|
'not null' => TRUE, |
| 47 |
|
'default' => 0), |
| 48 |
|
'last' => array( |
| 49 |
|
'type' => 'int', |
| 50 |
|
'unsigned' => TRUE, |
| 51 |
|
'not null' => TRUE, |
| 52 |
|
'default' => 0), |
| 53 |
|
), |
| 54 |
|
'primary key' => array('gid', 'nid'), |
| 55 |
|
); |
| 56 |
|
|
| 57 |
|
return $schema; |
| 58 |
|
|
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
/** |
| 62 |
|
* Implementation of hook_uninstall(). |
| 63 |
|
*/ |
| 64 |
|
function click_uninstall() { |
| 65 |
|
// Remove tables. |
| 66 |
|
drupal_uninstall_schema('click'); |
| 67 |
|
|
| 68 |
|
db_query("DELETE FROM {variable} WHERE name LIKE 'click_%';"); |
| 69 |
} |
} |
| 70 |
|
|