-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadvancedqueue.install
131 lines (125 loc) · 3.47 KB
/
advancedqueue.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
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
127
128
129
130
131
<?php
/**
* @file
* Install, update, and uninstall functions for the Advanced-queue module.
*/
/**
* Implements hook_enable().
*/
function advancedqueue_enable() {
if (variable_get('queue_default_class', NULL) === NULL) {
// Take ownership of all the queues.
variable_set('queue_default_class', 'AdvancedQueue');
}
}
/**
* Implements hook_disable().
*/
function advancedqueue_disable() {
if (variable_get('queue_default_class', NULL) === 'AdvancedQueue') {
// Let the queues run free.
variable_del('queue_default_class', 'AdvancedQueue');
}
}
/**
* Implements hook_schema().
*/
function advancedqueue_schema() {
$schema['advancedqueue'] = array(
'description' => 'Stores items in queues.',
'fields' => array(
'item_id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Primary Key: Unique item ID.',
),
'name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The queue name.',
),
'uid' => array(
'type' => 'int',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The user to which the item belongs.',
),
'title' => array(
'type' => 'varchar',
'length' => 400,
'not null' => TRUE,
'description' => 'The title of this item.',
),
'data' => array(
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'The arbitrary data for the item.',
),
'result' => array(
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'The arbitrary result for the item, only significant if {advancedqueue}.status <> 0',
),
'expire' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Timestamp when the claim lease expires on the item.',
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => ADVANCEDQUEUE_STATUS_QUEUED,
'size' => 'tiny',
'description' => 'Indicates whether the item has been processed (-1 = queue, 0 = processing, 1 = successfully processed, 2 = failed).',
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Timestamp when the item was created.',
),
'processed' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Timestamp when the item was processed.',
),
),
'primary key' => array('item_id'),
'indexes' => array(
'queue' => array('name', 'status', 'expire', 'created'),
),
);
$schema['advancedqueue_tags'] = array(
'description' => 'Stores tags of items in queues.',
'fields' => array(
'item_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'A {advancedqueue}.item_id',
),
'tag' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The queue name.',
),
),
'primary key' => array('item_id', 'tag'),
'indexes' => array(
'tag' => array('tag'),
),
);
return $schema;
}