| 1 |
<?php
|
| 2 |
// $Id: ldapdata.install,v 1.8 2009/05/03 21:58:13 miglius Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* ldapdata module installation and upgrade code.
|
| 7 |
*/
|
| 8 |
|
| 9 |
//////////////////////////////////////////////////////////////////////////////
|
| 10 |
// Core API hooks
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Implementation of hook_install().
|
| 14 |
*/
|
| 15 |
function ldapdata_install() {
|
| 16 |
// We're adding to an existing table, not creating a new one.
|
| 17 |
$ret = array();
|
| 18 |
|
| 19 |
db_add_field($ret, 'ldapauth', 'ldapdata_binddn', array(
|
| 20 |
'type' => 'varchar',
|
| 21 |
'length' => 255,
|
| 22 |
));
|
| 23 |
db_add_field($ret, 'ldapauth', 'ldapdata_bindpw', array(
|
| 24 |
'type' => 'varchar',
|
| 25 |
'length' => 255,
|
| 26 |
));
|
| 27 |
db_add_field($ret, 'ldapauth', 'ldapdata_rwattrs', array(
|
| 28 |
'type' => 'text',
|
| 29 |
'not null' => FALSE,
|
| 30 |
));
|
| 31 |
db_add_field($ret, 'ldapauth', 'ldapdata_roattrs', array(
|
| 32 |
'type' => 'text',
|
| 33 |
'not null' => FALSE,
|
| 34 |
));
|
| 35 |
db_add_field($ret, 'ldapauth', 'ldapdata_mappings', array(
|
| 36 |
'type' => 'text',
|
| 37 |
'not null' => FALSE,
|
| 38 |
));
|
| 39 |
db_add_field($ret, 'ldapauth', 'ldapdata_attrs', array(
|
| 40 |
'type' => 'text',
|
| 41 |
'not null' => FALSE,
|
| 42 |
));
|
| 43 |
db_add_field($ret, 'ldapauth', 'ldapdata_filter_php', array(
|
| 44 |
'type' => 'text',
|
| 45 |
'not null' => FALSE,
|
| 46 |
));
|
| 47 |
|
| 48 |
return $ret;
|
| 49 |
}
|
| 50 |
|
| 51 |
/**
|
| 52 |
* Implementation of hook_uninstall().
|
| 53 |
*/
|
| 54 |
function ldapdata_uninstall() {
|
| 55 |
// We're removing fileds from an existing table, not deleting a whole one.
|
| 56 |
$ret = array();
|
| 57 |
|
| 58 |
db_drop_field($ret, 'ldapauth', 'ldapdata_binddn');
|
| 59 |
db_drop_field($ret, 'ldapauth', 'ldapdata_bindpw');
|
| 60 |
db_drop_field($ret, 'ldapauth', 'ldapdata_rwattrs');
|
| 61 |
db_drop_field($ret, 'ldapauth', 'ldapdata_roattrs');
|
| 62 |
db_drop_field($ret, 'ldapauth', 'ldapdata_mappings');
|
| 63 |
db_drop_field($ret, 'ldapauth', 'ldapdata_attrs');
|
| 64 |
db_drop_field($ret, 'ldapauth', 'ldapdata_filter_php');
|
| 65 |
|
| 66 |
// Remove variables
|
| 67 |
variable_del('ldapdata_sync');
|
| 68 |
|
| 69 |
return $ret;
|
| 70 |
}
|
| 71 |
|
| 72 |
function ldapdata_update_6001() {
|
| 73 |
$ret = array();
|
| 74 |
db_add_field($ret, 'ldapauth', 'ldapdata_attrs', array(
|
| 75 |
'type' => 'text',
|
| 76 |
'not null' => FALSE,
|
| 77 |
));
|
| 78 |
db_add_field($ret, 'ldapauth', 'ldapdata_filter_php', array(
|
| 79 |
'type' => 'text',
|
| 80 |
'not null' => FALSE,
|
| 81 |
));
|
| 82 |
return $ret;
|
| 83 |
}
|
| 84 |
|
| 85 |
function ldapdata_update_6002() {
|
| 86 |
$ret = array();
|
| 87 |
db_change_field($ret, 'ldapauth', 'ldapdata_rwattrs', 'ldapdata_rwattrs', array(
|
| 88 |
'type' => 'text',
|
| 89 |
'not null' => FALSE,
|
| 90 |
));
|
| 91 |
db_change_field($ret, 'ldapauth', 'ldapdata_roattrs', 'ldapdata_roattrs', array(
|
| 92 |
'type' => 'text',
|
| 93 |
'not null' => FALSE,
|
| 94 |
));
|
| 95 |
db_change_field($ret, 'ldapauth', 'ldapdata_mappings', 'ldapdata_mappings', array(
|
| 96 |
'type' => 'text',
|
| 97 |
'not null' => FALSE,
|
| 98 |
));
|
| 99 |
return $ret;
|
| 100 |
}
|
| 101 |
|