| 1 |
<?php
|
| 2 |
// $Id: postcard.install,v 1.8 2007/09/13 01:45:43 add1sun Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Install.
|
| 6 |
*/
|
| 7 |
function postcard_install() {
|
| 8 |
// This is the new install hook for Drupal 6.
|
| 9 |
drupal_install_schema('postcard');
|
| 10 |
|
| 11 |
// set some default variables
|
| 12 |
variable_set('postcard_term', '0');
|
| 13 |
variable_set('postcard_cron', '0');
|
| 14 |
}
|
| 15 |
|
| 16 |
/**
|
| 17 |
* Implementation of hook_uninstall().
|
| 18 |
*/
|
| 19 |
function postcard_uninstall() {
|
| 20 |
drupal_uninstall_schema('postcard');
|
| 21 |
variable_del('postcard_term');
|
| 22 |
variable_del('postcard_cron');
|
| 23 |
variable_del('postcard_subject');
|
| 24 |
variable_del('postcard_letter');
|
| 25 |
variable_del('postcard_help');
|
| 26 |
}
|
| 27 |
|
| 28 |
/**
|
| 29 |
* Implementation of hook_schema().
|
| 30 |
**/
|
| 31 |
function postcard_schema() {
|
| 32 |
$schema['postcard'] = array(
|
| 33 |
'description' => array('Stores data for postcards from postcard module.'),
|
| 34 |
'fields' => array(
|
| 35 |
'pid' => array(
|
| 36 |
'description' => 'Primary Key: Unique postcard ID.',
|
| 37 |
'type' => 'varchar',
|
| 38 |
'length' => 64,
|
| 39 |
'not null' => TRUE,
|
| 40 |
'default' => '',
|
| 41 |
),
|
| 42 |
'nid' => array(
|
| 43 |
'description' => 'The {node}.nid of the node with the image for the postcard.',
|
| 44 |
'type' => 'int',
|
| 45 |
'default' => 0,
|
| 46 |
),
|
| 47 |
'uid' => array(
|
| 48 |
'description' => 'The {users}.uid of the user who created the postcard.',
|
| 49 |
'type' => 'int',
|
| 50 |
'default' => 0,
|
| 51 |
),
|
| 52 |
'sender_name' => array(
|
| 53 |
'description' => 'The name filled in the sender name field on the postcard form.',
|
| 54 |
'type' => 'varchar',
|
| 55 |
'length' => 128,
|
| 56 |
'default' => '',
|
| 57 |
),
|
| 58 |
'sender_mail' => array(
|
| 59 |
'description' => 'The email filled in the sender email field on the postcard form.',
|
| 60 |
'type' => 'varchar',
|
| 61 |
'length' => 64,
|
| 62 |
'default' => '',
|
| 63 |
),
|
| 64 |
'recp_name' => array(
|
| 65 |
'description' => 'The name filled in the recipient name field on the postcard form.',
|
| 66 |
'type' => 'varchar',
|
| 67 |
'length' => 128,
|
| 68 |
'default' => '',
|
| 69 |
),
|
| 70 |
'recp_mail' => array(
|
| 71 |
'description' => 'The email filled in the recipient email field on the postcard form.',
|
| 72 |
'type' => 'varchar',
|
| 73 |
'length' => 64,
|
| 74 |
'default' => '',
|
| 75 |
),
|
| 76 |
'body' => array(
|
| 77 |
'description' => 'The text for the body of the postcard.',
|
| 78 |
'type' => 'text',
|
| 79 |
'size' => 'big',
|
| 80 |
),
|
| 81 |
'send_time' => array(
|
| 82 |
'description' => 'Timestamp for when the postcard was sent.',
|
| 83 |
'type' => 'int',
|
| 84 |
'default' => 0,
|
| 85 |
),
|
| 86 |
'recp_time' => array(
|
| 87 |
'description' => 'Timestamp for when the postcard was viewed by the recipient.',
|
| 88 |
'type' => 'int',
|
| 89 |
'default' => 0,
|
| 90 |
),
|
| 91 |
'count_view' => array(
|
| 92 |
'description' => 'Number of times the postcard has been viewed.',
|
| 93 |
'type' => 'int',
|
| 94 |
'size' => 'medium',
|
| 95 |
'default' => 0,
|
| 96 |
),
|
| 97 |
),
|
| 98 |
'indexes' => array('nid', 'uid'),
|
| 99 |
'primary key' => array('pid'),
|
| 100 |
);
|
| 101 |
return $schema;
|
| 102 |
}
|
| 103 |
|
| 104 |
/**
|
| 105 |
* Implementation of hook_update().
|
| 106 |
**/
|
| 107 |
function postcard_update_1() {
|
| 108 |
variable_set('postcard_cron', '0');
|
| 109 |
// this needs to be returned so update doesn't freak out
|
| 110 |
return array();
|
| 111 |
}
|