-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathislandora_zip_download.rules.inc
126 lines (120 loc) · 3.68 KB
/
islandora_zip_download.rules.inc
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/**
* @file
* Rules hook implementations.
*/
/**
* Implements hook_rules_event_info().
*/
function islandora_zip_download_rules_event_info() {
$event = array();
$event['islandora_zip_download_zip_generated'] = array(
'label' => t('ZIP Generation Complete'),
'group' => t('Islandora ZIP Download'),
'variables' => array(
'stats' => array(
'label' => t('Generation stats'),
'description' => t('Datastream count and file size information.'),
'type' => 'islandora_zip_download_generation_stats',
),
'paths' => array(
'label' => t('ZIP files'),
'description' => t('All ZIP files (and reassembly helper scripts). A file containing the same is available as "file_list" on "meta".'),
'type' => 'list<uri>',
),
'meta' => array(
'label' => t('Meta files'),
'description' => t('URLs to files describing the files.'),
'type' => 'islandora_zip_download_meta_files',
),
'constrained' => array(
'label' => t('Constrained?'),
'description' => t('A boolean flag indicating if the generation of ZIP files was stopped prematurely due to hitting a size constraint (some data which was selected was not included).'),
'type' => 'boolean',
),
'expiry' => array(
'label' => t('Expiry'),
'type' => 'integer',
),
),
);
$event['islandora_zip_download_zip_empty'] = array(
'label' => t('ZIP Generation resulted in empty archive'),
'group' => t('Islandora ZIP Download'),
'variables' => array(
'params' => array(
'label' => t('Generation params'),
'type' => 'list<list<text>>',
),
'constrained' => array(
'label' => t('Constrained?'),
'description' => t('A boolean flag indicating if the generation of ZIP files was stopped prematurely due to hitting a size constraint (some data which was selected was not included).'),
'type' => 'boolean',
),
),
);
return $event;
}
/**
* Implements hook_rules_data_info().
*/
function islandora_zip_download_rules_data_info() {
$type = array();
$file_size_properties = array(
'human_readable' => array(
'label' => t('Human-readable file size'),
'type' => 'text',
'getter callback' => 'islandora_zip_download_rules_file_size_to_human_readable',
'computed' => TRUE,
),
);
$type['islandora_zip_download_generation_stats'] = array(
'label' => t('Generation statistics'),
'group' => t('Islandora ZIP Download'),
'type' => 'struct',
'wrap' => TRUE,
'property info' => array(
'count' => array(
'label' => t('Datastream count'),
'type' => 'integer',
),
'size' => array(
'label' => t('Size statistics'),
'type' => 'struct',
'property info' => array(
'source' => array(
'label' => t('Source size'),
'type' => 'integer',
'property info' => $file_size_properties,
),
'compressed' => array(
'label' => t('Compressed size'),
'type' => 'integer',
'property info' => $file_size_properties,
),
),
),
),
);
$type['islandora_zip_download_meta_files'] = array(
'label' => t('Meta info'),
'group' => t('Islandora ZIP Download'),
'type' => 'list<uri>',
'wrap' => TRUE,
'property info' => array(
'file_list' => array(
'label' => t('File List'),
'type' => 'uri',
),
'md5' => array(
'label' => t('MD5 sum file'),
'type' => 'uri',
),
'sha1' => array(
'label' => t('SHA1 sum file'),
'type' => 'uri',
),
),
);
return $type;
}