1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Install, update and uninstall functions for the LDAP API module.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
/**
|
10 |
|
|
* Implements hook_install().
|
11 |
|
|
*/
|
12 |
|
|
function ldap_query_install() {
|
13 |
|
|
|
14 |
|
|
}
|
15 |
|
|
|
16 |
|
|
/**
|
17 |
|
|
* Implements hook_uninstall().
|
18 |
|
|
*/
|
19 |
|
|
function ldap_query_uninstall() {
|
20 |
|
|
|
21 |
|
|
}
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/**
|
25 |
|
|
* Implements hook_schema().
|
26 |
|
|
*/
|
27 |
|
|
/**
|
28 |
|
|
* Implements hook_schema().
|
29 |
|
|
*/
|
30 |
|
|
function ldap_query_schema() {
|
31 |
|
|
|
32 |
|
|
$schema['ldap_query'] = array(
|
33 |
|
|
'export' => array(
|
34 |
|
|
'key' => 'qid',
|
35 |
|
|
'key name' => 'Query Name',
|
36 |
|
|
'identifier' => 'qid',
|
37 |
|
|
'primary key' => 'query_numeric_id',
|
38 |
|
|
'api' => array(
|
39 |
|
|
'owner' => 'ldap_query',
|
40 |
|
|
'api' => 'ldap_query',
|
41 |
|
|
'minimum_version' => 1,
|
42 |
|
|
'current_version' => 1,
|
43 |
|
|
),
|
44 |
|
|
),
|
45 |
|
|
|
46 |
|
|
'description' => "LDAP Query Data leveraged by other LDAP Modules",
|
47 |
|
|
'primary key' => array('query_numeric_id'),
|
48 |
|
|
'foreign keys' => array(
|
49 |
|
|
'sid' => array(
|
50 |
|
|
'table' => 'ldap_servers',
|
51 |
|
|
'columns' => array('sid' => 'sid'),
|
52 |
|
|
),
|
53 |
|
|
),
|
54 |
|
|
);
|
55 |
|
|
module_load_include('module', 'ldap_servers');
|
56 |
|
|
ldap_servers_module_load_include('php', 'ldap_query', 'LdapQuery.class');
|
57 |
|
|
$fields = LdapQuery::fields();
|
58 |
|
|
foreach ($fields as $field_id => $field) {
|
59 |
|
|
if (isset($field['schema'])) {
|
60 |
|
|
$schema['ldap_query']['fields'][$field_id] = $field['schema'];
|
61 |
|
|
}
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
return $schema;
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
/**
|
68 |
|
|
* Add scope field to ldap_query table.
|
69 |
|
|
*/
|
70 |
|
|
function ldap_query_update_7100() {
|
71 |
|
|
module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
|
72 |
|
|
ldap_servers_module_load_include('module', 'ldap_servers', 'ldap_servers'); // get LDAP_SCOPE_SUBTREE constant
|
73 |
|
|
// make sure 'create_consumers' field is there for old 7.x-1.x-dev versions
|
74 |
|
|
if (!db_field_exists('ldap_query', 'scope')) {
|
75 |
|
|
db_add_field('ldap_query', 'scope', array(
|
76 |
|
|
'type' => 'int',
|
77 |
|
|
'size' => 'small',
|
78 |
|
|
'not null' => FALSE,
|
79 |
|
|
'default' => LDAP_SCOPE_SUBTREE,
|
80 |
|
|
));
|
81 |
|
|
return t('"scope" field added to ldap_query table');
|
82 |
|
|
}
|
83 |
|
|
else {
|
84 |
|
|
return t('No database changes made.');
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
/**
|
90 |
|
|
* Make filter field type 'text' for longer filters
|
91 |
|
|
*/
|
92 |
|
|
function ldap_query_update_7101() {
|
93 |
|
|
db_change_field('ldap_query', 'filter', 'filter', array(
|
94 |
|
|
'type' => 'text',
|
95 |
|
|
'not null' => FALSE,
|
96 |
|
|
));
|
97 |
|
|
|
98 |
|
|
return t('ldap_query table field "filter" changed to type "text"');
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
/**
|
103 |
|
|
* make ldap_query.scope field small int instead of tiny int for ctools bug
|
104 |
|
|
*/
|
105 |
|
|
function ldap_query_update_7102() {
|
106 |
|
|
|
107 |
|
|
db_change_field('ldap_query', 'scope', 'scope', array(
|
108 |
|
|
'type' => 'int',
|
109 |
|
|
'size' => 'small',
|
110 |
|
|
'not null' => TRUE,
|
111 |
|
|
'default' => 0,
|
112 |
|
|
));
|
113 |
|
|
|
114 |
|
|
} |