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

Contents of /contributions/modules/taxonomy_menu/taxonomy_menu.install

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


Revision 1.4 - (show annotations) (download) (as text)
Thu Apr 2 00:34:27 2009 UTC (7 months, 3 weeks ago) by indytechcook
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +100 -14 lines
File MIME type: text/x-php
Updated HEAD to latest 6.x-2 DEV
1 <?php
2 // $Id: taxonomy_menu.install,v 1.2.2.1.2.7 2009/03/25 21:29:13 indytechcook Exp $
3
4 /**
5 * @file
6 * Install and uninstall all required databases. Also do incremental database updates.
7 */
8
9 /**
10 * Implementation of hook_uninstall().
11 */
12 function taxonomy_menu_uninstall() {
13
14 //remove menu items
15 db_query("DELETE FROM {menu_links} WHERE module = '%s'", 'taxonomy_menu');
16
17 //rebuild the menus
18 variable_set('menu_rebuild_needed', TRUE);
19
20 // Delete variables
21 $variables = db_query('SELECT * from {variable}');
22 while ($variable = db_fetch_object($variables)) {
23 if (strpos($variable->name, 'taxonomy_menu') !== FALSE) {
24 variable_del($variable->name);
25 }
26 }
27
28 // remove table
29 drupal_uninstall_schema('taxonomy_menu');
30 }
31
32 /**
33 * Implementation of hook_install().
34 */
35 function taxonomy_menu_install() {
36 drupal_install_schema('taxonomy_menu');
37 }
38
39 /**
40 * Implementation of hook_schema().
41 */
42 function taxonomy_menu_schema() {
43
44 $schema['taxonomy_menu'] = array(
45 'description' => t('Links a taxonomy term to a menu item'),
46 'fields' => array(
47 'mlid' => array(
48 'type' => 'int',
49 'unsigned' => TRUE,
50 'not null' => TRUE,
51 'default' => 0,
52 'description' => t('The taxonomy terms {menu_link}.mlid'),
53 ),
54 'tid' => array(
55 'type' => 'int',
56 'unsigned' => TRUE,
57 'not null' => TRUE,
58 'default' => 0,
59 'description' => t('tid that is linked to the mlid'),
60 ),
61 'vid' => array(
62 'type' => 'int',
63 'unsigned' => TRUE,
64 'not null' => TRUE,
65 'default' => 0,
66 'description' => t('vid for the tid'),
67 ),
68 ),
69 'primary key' => array('mlid', 'tid'),
70 'indexes' => array(
71 'vid' => array('vid'),
72 ),
73 );
74 return $schema;
75 }
76
77 function taxonomy_menu_update_6200() {
78 $schema['taxonomy_menu'] = array(
79 'description' => t('Links a taxonomy term to a menu item'),
80 'fields' => array(
81 'mlid' => array(
82 'type' => 'int',
83 'unsigned' => TRUE,
84 'not null' => TRUE,
85 'default' => 0,
86 'description' => t('The taxonomy terms {menu_link}.mlid'),
87 ),
88 'tid' => array(
89 'type' => 'int',
90 'unsigned' => TRUE,
91 'not null' => TRUE,
92 'default' => 0,
93 'description' => t('tid that is linked to the mlid'),
94 ),
95 'vid' => array(
96 'type' => 'int',
97 'unsigned' => TRUE,
98 'not null' => TRUE,
99 'default' => 0,
100 'description' => t('vid for the tid'),
101 ),
102 ),
103 'primary key' => array('mlid', 'tid'),
104 'indexes' => array(
105 'vid' => array('vid'),
106 ),
107 );
108 $ret = array();
109 db_create_table($ret, 'taxonomy_menu', $schema['taxonomy_menu']);
110 return $ret;
111 }

  ViewVC Help
Powered by ViewVC 1.1.2