File: ldapgroups.install

package info (click to toggle)
drupal6-mod-ldap-integration 1.0~beta2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 280 kB
  • ctags: 4
  • sloc: pascal: 1,057; makefile: 30
file content (118 lines) | stat: -rw-r--r-- 3,289 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
// $Id: ldapgroups.install,v 1.6 2009/07/04 21:54:28 miglius Exp $

/**
 * @file
 * ldapgroups module installation and upgrade code.
 */

//////////////////////////////////////////////////////////////////////////////
// Core API hooks

/**
 * Implementation of hook_install().
 */
function ldapgroups_install() {
  // We're adding to an existing table, not creating a new one.
  $ret = array();

  db_add_field($ret, 'ldapauth', 'ldapgroups_in_dn', array(
    'type' => 'int',
    'size' => 'tiny',
    'not null' => TRUE,
    'default' => '0',
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_dn_attribute', array(
    'type' => 'varchar',
    'length' => 255,
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_attr', array(
    'type' => 'varchar',
    'length' => 255,
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_in_attr', array(
    'type' => 'int',
    'size' => 'tiny',
    'not null' => TRUE,
    'default' => '0',
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_as_entries', array(
    'type' => 'int',
    'size' => 'tiny',
    'not null' => TRUE,
    'default' => '0',
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_entries', array(
    'type' => 'text',
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_entries_attribute',  array(
    'type' => 'varchar',
    'length' => 255,
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings',  array(
    'type' => 'text',
    'not null' => FALSE,
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings_filter', array(
    'type' => 'int',
    'size' => 'tiny',
    'not null' => TRUE,
    'default' => '0',
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_filter_php',  array(
    'type' => 'text',
    'not null' => FALSE,
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_groups',  array(
    'type' => 'text',
    'not null' => FALSE,
  ));

  return $ret;
}

/**
 * Implementation of hook_uninstall().
 */
function ldapgroups_uninstall() {
  // We're removing fileds from an existing table, not deleting a whole one.
  $ret = array();

  db_drop_field($ret, 'ldapauth', 'ldapgroups_in_dn');
  db_drop_field($ret, 'ldapauth', 'ldapgroups_dn_attribute');
  db_drop_field($ret, 'ldapauth', 'ldapgroups_attr');
  db_drop_field($ret, 'ldapauth', 'ldapgroups_in_attr');
  db_drop_field($ret, 'ldapauth', 'ldapgroups_as_entries');
  db_drop_field($ret, 'ldapauth', 'ldapgroups_entries');
  db_drop_field($ret, 'ldapauth', 'ldapgroups_entries_attribute');
  db_drop_field($ret, 'ldapauth', 'ldapgroups_mappings');
  db_drop_field($ret, 'ldapauth', 'ldapgroups_mappings_filter');
  db_drop_field($ret, 'ldapauth', 'ldapgroups_filter_php');
  db_drop_field($ret, 'ldapauth', 'ldapgroups_groups');

  return $ret;
}

function ldapgroups_update_6001() {
  $ret = array();
  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings',  array(
    'type' => 'text',
    'not null' => FALSE,
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_mappings_filter', array(
    'type' => 'int',
    'size' => 'tiny',
    'not null' => TRUE,
    'default' => '0',
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_filter_php',  array(
    'type' => 'text',
    'not null' => FALSE,
  ));
  db_add_field($ret, 'ldapauth', 'ldapgroups_groups',  array(
    'type' => 'text',
    'not null' => FALSE,
  ));
  return $ret;
}