| 1 |
<?php
|
| 2 |
// $Id: ldapgroups.install,v 1.5 2009/05/03 21:58:13 miglius Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* ldapgroups module installation and upgrade code.
|
| 7 |
*/
|
| 8 |
|
| 9 |
//////////////////////////////////////////////////////////////////////////////
|
| 10 |
// Core API hooks
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Implementation of hook_install().
|
| 14 |
*/
|
| 15 |
function ldapgroups_install() {
|
| 16 |
// We're adding to an existing table, not creating a new one.
|
| 17 |
$ret = array();
|
| 18 |
|
| 19 |
db_add_field($ret, 'ldapauth', 'ldapgroups_in_dn', array(
|
| 20 |
'type' => 'int',
|
| 21 |
'size' => 'tiny',
|
| 22 |
'not null' => TRUE,
|
| 23 |
'default' => '0',
|
| 24 |
));
|
| 25 |
db_add_field($ret, 'ldapauth', 'ldapgroups_dn_attribute', array(
|
| 26 |
'type' => 'varchar',
|
| 27 |
'length' => 255,
|
| 28 |
));
|
| 29 |
db_add_field($ret, 'ldapauth', 'ldapgroups_attr', array(
|
| 30 |
'type' => 'varchar',
|
| 31 |
'length' => 255,
|
| 32 |
));
|
| 33 |
db_add_field($ret, 'ldapauth', 'ldapgroups_in_attr', array(
|
| 34 |
'type' => 'int',
|
| 35 |
'size' => 'tiny',
|
| 36 |
'not null' => TRUE,
|
| 37 |
'default' => '0',
|
| 38 |
));
|
| 39 |
db_add_field($ret, 'ldapauth', 'ldapgroups_as_entries', array(
|
| 40 |
'type' => 'int',
|
| 41 |
'size' => 'tiny',
|
| 42 |
'not null' => TRUE,
|
| 43 |
'default' => '0',
|
| 44 |
));
|
| 45 |
db_add_field($ret, 'ldapauth', 'ldapgroups_entries', array(
|
| 46 |
'type' => 'text',
|
| 47 |
));
|
| 48 |
db_add_field($ret, 'ldapauth', 'ldapgroups_entries_attribute', array(
|
| 49 |
'type' => 'varchar',
|
| 50 |
'length' => 255,
|
| 51 |
));
|
| 52 |
db_add_field($ret, 'ldapauth', 'ldapgroups_mappings', array(
|
| 53 |
'type' => 'text',
|
| 54 |
'not null' => FALSE,
|
| 55 |
));
|
| 56 |
db_add_field($ret, 'ldapauth', 'ldapgroups_mappings_filter', array(
|
| 57 |
'type' => 'int',
|
| 58 |
'size' => 'tiny',
|
| 59 |
'not null' => TRUE,
|
| 60 |
'default' => '0',
|
| 61 |
));
|
| 62 |
db_add_field($ret, 'ldapauth', 'ldapgroups_filter_php', array(
|
| 63 |
'type' => 'text',
|
| 64 |
'not null' => FALSE,
|
| 65 |
));
|
| 66 |
db_add_field($ret, 'ldapauth', 'ldapgroups_groups', array(
|
| 67 |
'type' => 'text',
|
| 68 |
'not null' => FALSE,
|
| 69 |
));
|
| 70 |
|
| 71 |
return $ret;
|
| 72 |
}
|
| 73 |
|
| 74 |
/**
|
| 75 |
* Implementation of hook_uninstall().
|
| 76 |
*/
|
| 77 |
function ldapgroups_uninstall() {
|
| 78 |
// We're removing fileds from an existing table, not deleting a whole one.
|
| 79 |
$ret = array();
|
| 80 |
|
| 81 |
db_drop_field($ret, 'ldapauth', 'ldapgroups_in_dn');
|
| 82 |
db_drop_field($ret, 'ldapauth', 'ldapgroups_dn_attribute');
|
| 83 |
db_drop_field($ret, 'ldapauth', 'ldapgroups_attr');
|
| 84 |
db_drop_field($ret, 'ldapauth', 'ldapgroups_in_attr');
|
| 85 |
db_drop_field($ret, 'ldapauth', 'ldapgroups_as_entries');
|
| 86 |
db_drop_field($ret, 'ldapauth', 'ldapgroups_entries');
|
| 87 |
db_drop_field($ret, 'ldapauth', 'ldapgroups_entries_attribute');
|
| 88 |
db_drop_field($ret, 'ldapauth', 'ldapgroups_mappings');
|
| 89 |
db_drop_field($ret, 'ldapauth', 'ldapgroups_mappings_filter');
|
| 90 |
db_drop_field($ret, 'ldapauth', 'ldapgroups_filter_php');
|
| 91 |
db_drop_field($ret, 'ldapauth', 'ldapgroups_groups');
|
| 92 |
|
| 93 |
return $ret;
|
| 94 |
}
|
| 95 |
|
| 96 |
function ldapgroups_update_6001() {
|
| 97 |
$ret = array();
|
| 98 |
db_add_field($ret, 'ldapauth', 'ldapgroups_mappings', array(
|
| 99 |
'type' => 'text',
|
| 100 |
'not null' => FALSE,
|
| 101 |
));
|
| 102 |
db_add_field($ret, 'ldapauth', 'ldapgroups_mappings_filter', array(
|
| 103 |
'type' => 'int',
|
| 104 |
'size' => 'tiny',
|
| 105 |
'not null' => TRUE,
|
| 106 |
'default' => '0',
|
| 107 |
));
|
| 108 |
db_add_field($ret, 'ldapauth', 'ldapgroups_filter_php', array(
|
| 109 |
'type' => 'text',
|
| 110 |
'not null' => FALSE,
|
| 111 |
));
|
| 112 |
db_add_field($ret, 'ldapauth', 'ldapgroups_groups', array(
|
| 113 |
'type' => 'text',
|
| 114 |
'not null' => FALSE,
|
| 115 |
));
|
| 116 |
return $ret;
|
| 117 |
}
|
| 118 |
|