| 1 |
<?php
|
| 2 |
// $Id: technorati.install,v 1.1 2006/10/28 02:17:35 kbahey Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Installation and uninstallation code for the technorati module.
|
| 7 |
*
|
| 8 |
* Copyright (c) 2006 http://2bits.com
|
| 9 |
* Copyright (c) 2008 Jan Dittberner <jan@dittberner.info>
|
| 10 |
*/
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Implementation of hook_install().
|
| 14 |
*/
|
| 15 |
function technorati_install() {
|
| 16 |
$result = drupal_install_schema('technorati');
|
| 17 |
|
| 18 |
if (count($result) > 0) {
|
| 19 |
drupal_set_message(t('technorati module installed.'));
|
| 20 |
}
|
| 21 |
else {
|
| 22 |
drupal_set_message(t('technorati table creation failed. Please "uninstall" the module and retry.'));
|
| 23 |
}
|
| 24 |
}
|
| 25 |
|
| 26 |
/**
|
| 27 |
* Implementation of hook_uninstall().
|
| 28 |
*/
|
| 29 |
function technorati_uninstall() {
|
| 30 |
drupal_uninstall_schema('technorati');
|
| 31 |
|
| 32 |
// delete variables
|
| 33 |
variable_del('technorati_display_type');
|
| 34 |
foreach (node_get_types() as $node_type => $node_name) {
|
| 35 |
variable_del('technorati_node_type_'. $node_type);
|
| 36 |
}
|
| 37 |
|
| 38 |
drupal_set_message(t('technorati module uninstalled.'));
|
| 39 |
}
|
| 40 |
|
| 41 |
/**
|
| 42 |
* Implementation of hook_schema().
|
| 43 |
*/
|
| 44 |
function technorati_schema() {
|
| 45 |
$schema['technorati'] = array(
|
| 46 |
'fields' => array(
|
| 47 |
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE,
|
| 48 |
'default' => 0),
|
| 49 |
'tags' => array('type' => 'text', 'size' => 'normal',
|
| 50 |
'not null' => TRUE, 'default' => '')
|
| 51 |
),
|
| 52 |
'indexes' => array(
|
| 53 |
'nid' => array('nid')
|
| 54 |
),
|
| 55 |
'primary key' => array('nid'),
|
| 56 |
);
|
| 57 |
|
| 58 |
return $schema;
|
| 59 |
}
|