This repository has been archived by the owner on Jun 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocviewer.install
95 lines (92 loc) · 2.69 KB
/
docviewer.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
<?php
/**
* @file
* Install, update and uninstall functions for the docviewer module.
*/
require_once('docviewer.cfg');
function docviewer_schema() {
$schema['docviewer_documents'] = array(
'description' => 'Information about documents',
'fields' => array(
'docid' => array(
'description' => 'The document identifier.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE),
'name' => array(
'description' => 'The document name.',
'type' => 'varchar',
'length' => 256,
'not null' => TRUE),
'filename' => array(
'description' => 'The document filename.',
'type' => 'varchar',
'length' => 256,
'not null' => TRUE),
'pages' => array(
'description' => 'Pages count in the document.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE),
'upload_date' => array(
'description' => 'The document upload date.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE),
'uid' => array(
'description' => 'User upload the document.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE),
'md5sum' => array(
'description' => 'The document MD5 summ.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE),
'filesize' => array(
'description' => 'Filesize in bytes.',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE),
'active' => array(
'type' => 'int',
'description' => 'Processing status.',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0),
'download' => array(
'type' => 'int',
'description' => 'It allowed to download.',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0),
'subject' => array(
'description' => 'Subject og the document.',
'type' => 'varchar',
'length' => 256,
'not null' => TRUE),
),
'unique keys' => array(
'docid' => array('docid'),
'md5sum' => array('md5sum'),
),
'primary key' => array('docid'),
);
return $schema;
}
function docviewer_install() {
$file_directory = file_directory_path();
$source_directory = "$file_directory/$_source_path";
$cache_directory = "$file_directory/$_cache_path";
if (!file_check_directory($source_directory, FILE_CREATE_DIRECTORY)) {
drupal_set_message(check_plain("Can't create directory". $source_directory), 'error');
}
if (!file_check_directory($cache_directory, FILE_CREATE_DIRECTORY)) {
drupal_set_message(check_plain("Can't create directory". $cache_directory), 'error');
}
drupal_install_schema('docviewer');
}
//TODO:Delete folders?
function docviewer_uninstall() {
drupal_uninstall_schema('docviewer');
}