-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHTPasswdSync.install
70 lines (61 loc) · 1.59 KB
/
HTPasswdSync.install
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
<?php
/**
* Install plugin
* @return void
*/
function htpasswdsync_install() {
drupal_install_schema('htpasswdsync_db');
}
/**
* Uninstall plugin
* @return void
*/
function htpasswdsync_uninstall() {
db_query("DELETE FROM {variable} WHERE LOCATE('htpasswdsync_', name) = 1");
drupal_uninstall_schema('htpasswdsync_db');
}
/**
* Returns module database schema specification
* @return array
*/
function htpasswdsync_db_schema() {
$schema['htpasswdsync_htpasswd'] = array(
'fields' => array(
'username' => array(
'description' => 'The {users}.username.',
'type' => 'varchar',
'length' => 128,
'not null' => true,
'default' => 0,
),
'passwd' => array(
'description' => 'The crypted (crypt) password.',
'type' => 'varchar',
'length' => 128,
'not null' => true,
'default' => '',
),
),
'primary key' => array('username'),
);
return $schema;
}
/**
* Enable plugin: Refresh database
* @return void
*/
function htpasswdsync_enable() {
if(variable_get('htpasswdsync_htpasswd', '---NOT--CONFIGURED---') != '---NOT--CONFIGURED---') {
_htpasswdsync_updatepasswd(false);
}
}
/**
* Disable plugin: remove users from htuser/htgroup file
* @return void
*/
function htpasswdsync_disable() {
if(variable_get('htpasswdsync_htpasswd', '---NOT--CONFIGURED---') != '---NOT--CONFIGURED---') {
_htpasswdsync_updatepasswd(true);
}
}
?>