drupal-6.trigger.database.php
1.6 KB
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
<?php
/**
* @file
* Test content for the trigger upgrade path.
*/
db_create_table('trigger_assignments', array(
'fields' => array(
'hook' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'op' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'aid' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('hook', 'op', 'aid'),
'module' => 'trigger',
'name' => 'trigger_assignments',
));
// Add several trigger configurations.
db_insert('trigger_assignments')->fields(array(
'hook',
'op',
'aid',
'weight',
))
->values(array(
'hook' => 'node',
'op' => 'presave',
'aid' => 'node_publish_action',
'weight' => '1',
))
->values(array(
'hook' => 'comment',
'op' => 'presave',
'aid' => 'comment_publish_action',
'weight' => '1',
))
->values(array(
'hook' => 'comment_delete',
'op' => 'presave',
'aid' => 'node_save_action',
'weight' => '1',
))
->values(array(
'hook' => 'nodeapi',
'op' => 'presave',
'aid' => 'node_make_sticky_action',
'weight' => '1',
))
->values(array(
'hook' => 'nodeapi',
'op' => 'somehow_nodeapi_got_a_very_long',
'aid' => 'node_save_action',
'weight' => '1',
))
->execute();
db_update('system')->fields(array(
'schema_version' => '6000',
'status' => '1',
))
->condition('filename', 'modules/trigger/trigger.module')
->execute();