| 1 |
<?php
|
| 2 |
// $Id:
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function favorite_nodes_install() {
|
| 8 |
$result = drupal_install_schema('favorite_nodes');
|
| 9 |
if (count($result) > 0) {
|
| 10 |
drupal_set_message(t('favorite node module installed.'));
|
| 11 |
}
|
| 12 |
else {
|
| 13 |
drupal_set_message(t('favorite node table creation failed. Please "uninstall" the module and retry.'));
|
| 14 |
}
|
| 15 |
}
|
| 16 |
|
| 17 |
/**
|
| 18 |
* Implementation of hook_uninstall().
|
| 19 |
*
|
| 20 |
*/
|
| 21 |
function favorite_nodes_uninstall() {
|
| 22 |
db_query("DELETE FROM {variable} WHERE name LIKE 'favorite_node%'");
|
| 23 |
drupal_uninstall_schema('favorite_nodes');
|
| 24 |
}
|
| 25 |
|
| 26 |
/**
|
| 27 |
* Implementation of hook_schema().
|
| 28 |
*/
|
| 29 |
function favorite_nodes_schema() {
|
| 30 |
$schema['favorite_nodes'] = array(
|
| 31 |
'fields' => array(
|
| 32 |
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
| 33 |
'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
|
| 34 |
'last' => array('type' => 'int'),
|
| 35 |
),
|
| 36 |
'primary key' => array('nid' ,'uid')
|
| 37 |
);
|
| 38 |
|
| 39 |
return $schema;
|
| 40 |
|
| 41 |
}
|