-
Notifications
You must be signed in to change notification settings - Fork 0
/
webfm.install
executable file
·100 lines (93 loc) · 3.76 KB
/
webfm.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
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
<?php
/**
* @file
* Install, update and uninstall functions for the webfm module.
*/
/**
* Implementation of hook_install().
*/
function webfm_install() {
//drupal_install_schema('webfm');
}
/**
* Implementation of hook_uninstall().
*/
function webfm_uninstall() {
drupal_uninstall_schema('webfm');
variable_del('webfm_root_dir');
variable_del('webfm_ftp_enable');
variable_del('webfm_ftp_root_dir');
variable_del('webfm_icon_dir');
variable_del('webfm_attach_body');
variable_del('webfm_attach_desc');
variable_del('webfm_attach_date');
variable_del('webfm_attach_size');
variable_del('webfm_debug');
variable_del('webfm_display_title');
variable_del('webfm_display_date');
variable_del('webfm_display_size');
variable_del('webfm_display_owner');
variable_del('webfm_cron');
variable_del('webfm_max_resolution');
variable_del('webfm_ie_dd_list_offset');
variable_del('webfm_ie_dd_tree_offset');
$roles = user_roles(1, 'access webfm');
foreach ($roles as $rid => $role) {
variable_del('root_dir_'. $rid);
variable_del('webfm_extensions_'. $rid);
variable_del('webfm_uploadsize_'. $rid);
variable_del('webfm_usersize_'. $rid);
}
if (module_exists('og')) {
$groups = og_all_groups_options();
foreach ($groups as $gid => $group) {
variable_del('root_dir_group_'. $gid);
}
}
$types = _node_types_build()->types;;
foreach ($types as $type) {
if ($type->type) {
variable_del('webfm_attach_'. $type->type);
}
}
variable_del('webfm_file_perm_role');
variable_del('webfm_file_perm_mod');
variable_del('webfm_file_perm_attach');
variable_del('webfm_file_public');
variable_del('webfm_date_format');
variable_del('webfm_attach_new_window');
}
/**
* Implementation of hook_schema().
*/
function webfm_schema() {
$schema['webfm_file'] = array(
'fields' => array(
'fid' => array('type' => 'serial', 'size' => 'normal', 'unsigned' => TRUE, 'not null' => TRUE),
'uid' => array('type' => 'int', 'size' => 'normal', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
'fpath' => array('type' => 'text', 'size' => 'medium', 'not null' => TRUE),
'fsize' => array('type' => 'int', 'size' => 'normal', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
'fmime' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
'ftitle' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
'fdesc' => array('type' => 'text', 'size' => 'normal', 'not null' => TRUE),
'fcreatedate' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
'flang' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
'fpublisher' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
'fformat' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
'fversion' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
'perm' => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0),
'dl_cnt' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
),
'primary key' => array('fid'),
);
$schema['webfm_attach'] = array(
'fields' => array(
'nid' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
'fid' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
'weight' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
'cid' => array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'default' => 0),
),
'primary key' => array('nid', 'fid', 'cid' ),
);
return $schema;
}