-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuy_file.install
55 lines (52 loc) · 1.62 KB
/
buy_file.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
<?php
function buy_file_schema() {
$schema['user_file_download'] = array(
'description' => 'Lists files {files} and users {users} that can download',
'fields' => array(
'fid' => array(
'description' => 'File id {files}.fid of file to download',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'description' => 'User id who downloaded file. {users}.uid',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'downloadable' => array(
'description' => 'True false value to allow you to download',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'fid' => array('fid'),
'uid' => array('uid'),
),
);
return $schema;
}
function buy_file_install() {
drupal_install_schema('buy_file');
if (!module_exists('private_download')) {
drupal_set_message(t('It is recommended you use the Private Download
module in order to protect your files.'));
}
drupal_set_message(t('You must configure buy file <a href=@url>here</a>', array('@url' => base_path() . 'admin/settings/buy-file')));
}
function buy_file_uninstall() {
drupal_uninstall_schema('buy_file');
variable_del('buy_file_file_directory');
variable_del('file_cost');
variable_del('buy_file_repurchase');
variable_del('buy_file_has_permission');
variable_del('buy_file_thank_you');
variable_del('buy_file_no_purchased_download');
variable_del('buy_file_number');
}