/[drupal]/contributions/modules/technorati/technorati.install
ViewVC logotype

Diff of /contributions/modules/technorati/technorati.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Sat Oct 28 02:17:35 2006 UTC revision 1.1.4.1, Sun Nov 30 22:33:46 2008 UTC
# Line 1  Line 1 
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']) {    switch ($GLOBALS['db_type']) {
17      case 'mysqli':      case 'mysqli':
18      case 'mysql':      case 'mysql':
19        $result = db_query("        $result = db_query("
20          CREATE TABLE {technorati} (          CREATE TABLE {technorati} (
21            nid INT  NOT NULL default '0',            nid INT  NOT NULL default '0',
# Line 14  function technorati_install() { Line 23  function technorati_install() {
23            PRIMARY KEY nid (nid)            PRIMARY KEY nid (nid)
24          ) /*!40100 DEFAULT CHARACTER SET utf8 */;");          ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
25        break;        break;
26        case 'pgsql':
27          $result = db_query("
28            CREATE TABLE {technorati} (
29              nid INT NOT NULL DEFAULT 0 PRIMARY KEY,
30              tags TEXT NOT NULL DEFAULT ''
31            );");
32          break;
33        default:
34          drupal_set_message(t('unsupported database type'), 'error');
35          return;
36      }
37      drupal_set_message(t('technorati module installed.'));
38    }
39    
40    /**
41     * Implementation of hook_uninstall().
42     */
43    function technorati_uninstall() {
44      switch ($GLOBALS['db_type']) {
45        case 'mysqli':
46        case 'mysql':
47        case 'pgsql':
48          $result = db_query("DROP TABLE {technorati};");
49          break;
50        default:
51          drupal_set_message(t('unsupported database type'), 'error');
52          return;
53      }
54      // delete variables
55      variable_del('technorati_display_type');
56      variable_del('technorati_unify_tags');
57      variable_del('technorati_sort_tags');
58      variable_del('technorati_hide_notags');
59      foreach (node_get_types() as $node_type => $node_name) {
60        variable_del('technorati_node_type_'. $node_type);
61    }    }
62  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.4.1

  ViewVC Help
Powered by ViewVC 1.1.2