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

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

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


Revision 1.1 - (show annotations) (download) (as text)
Sun May 3 02:57:41 2009 UTC (6 months, 3 weeks ago) by newzeal
Branch: MAIN
CVS Tags: DRUPAL-5--1-04, DRUPAL-5--1-05, HEAD
File MIME type: text/x-php
First commit
1 <?php
2 /**
3 * $Id: adv_taxonomy_menu.install,v 1.1.2.1 2008/01/15 22:14:56 brmassa Exp $
4 * @file adv_taxonomy_menu.install
5 * Install and uninstall all required databases.
6 * Also do incremental database updates.
7 */
8 //need to add modification: add mid to table
9 function adv_taxonomy_menu_install() {
10 switch ($GLOBALS['db_type']) {
11 case 'mysql':
12 case 'mysqli':
13 db_query("CREATE TABLE {adv_taxonomy_menu} (
14 tmid int(11) NOT NULL,
15 mid int(11) NOT NULL,
16 name varchar(55) NOT NULL default '',
17 display_page varchar(55) NOT NULL default '',
18 display_num int(1) NOT NULL default 0,
19 hide_empty int(1) NOT NULL default 0,
20 display_descendants int(1) NOT NULL default 0,
21 vocab_order longtext NULL default '',
22 show_normal longtext NULL default '',
23 show_views longtext NULL default '',
24 PRIMARY KEY (tmid)
25 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
26
27 break;
28 case 'pgsql':
29 db_query("CREATE TABLE {adv_taxonomy_menu} (
30 tmid numeric(11) NOT NULL,
31 mid numeric(11) NOT NULL,
32 name varchar(55) NULL,
33 display_page varchar(55) NULL,
34 display_num numeric(1) NOT NULL default 0,
35 hide_empty numeric(1) NOT NULL default 0,
36 display_descendants numeric(1) NOT NULL default 0,
37 vocab_order longtext NULL,
38 show_normal longtext NULL,
39 show_views longtext NULL,
40 PRIMARY KEY (tmid)
41 );");
42
43 break;
44 }
45
46
47 // Need og_readme() function.
48 // drupal_load('module', 'adv_taxonomy_menu');
49 drupal_set_message(t('Advanced taxonomy module enabled. Please see the included README file for further installation instructions.'));
50
51 }
52
53 /**
54 * Delete all SQL tables and global variables
55 * used by this module in other to let no garbage
56 * behind
57 */
58 function adv_taxonomy_menu_uninstall() {
59 db_query('DROP TABLE {adv_taxonomy_menu}');
60
61 // Delete variables
62 foreach (taxonomy_get_vocabularies() as $vocabulary) {
63 variable_del('adv_taxonomy_menu_show_'. $vocabulary->vid);
64 variable_del('adv_taxonomy_menu_show_view_'. $vocabulary->vid);
65 }
66 variable_del('adv_taxonomy_menu_display_num');
67 variable_del('adv_taxonomy_menu_hide_empty');
68 variable_del('adv_taxonomy_menu_display_page');
69 variable_del('adv_taxonomy_menu_display_descendants');
70 }
71
72 /**
73 * Add parent ID field for menu system
74 */
75 function adv_taxonomy_menu_update_1() {
76 $ret = array();
77
78 switch ($GLOBALS['db_type']) {
79 case 'pgsql':
80 db_add_column($ret, 'adv_taxonomy_menu', 'mid', 'int', array('not null' => TRUE, 'default' => ''));
81 break;
82
83 case 'mysql':
84 case 'mysqli':
85 $ret[] = update_sql("ALTER TABLE {adv_taxonomy_menu} ADD COLUMN mid int(11) NOT NULL");
86 break;
87 }
88
89 return $ret;
90 }

  ViewVC Help
Powered by ViewVC 1.1.2