| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: technorati.install,v 1.1 2006/10/28 02:17:35 kbahey Exp $ |
| 3 |
|
|
| 4 |
// Copyright 2006 http://2bits.com |
/** |
| 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() { |
function technorati_install() { |
| 16 |
switch ($GLOBALS['db_type']) { |
$result = drupal_install_schema('technorati'); |
| 17 |
case 'mysqli': |
|
| 18 |
case 'mysql': |
if (count($result) > 0) { |
| 19 |
$result = db_query(" |
drupal_set_message(t('technorati module installed.')); |
| 20 |
CREATE TABLE {technorati} ( |
} |
| 21 |
nid INT NOT NULL default '0', |
else { |
| 22 |
tags TEXT NOT NULL default '', |
drupal_set_message(t('technorati table creation failed. Please "uninstall" the module and retry.')); |
| 23 |
PRIMARY KEY nid (nid) |
} |
| 24 |
) /*!40100 DEFAULT CHARACTER SET utf8 */;"); |
} |
| 25 |
break; |
|
| 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 |
} |
} |