Projet

Général

Profil

Paste
Télécharger (1,99 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / flag / flag_actions.install @ d719f12f

1
<?php
2

    
3
/**
4
 * @file
5
 * Flag actions install file.
6
 */
7

    
8
/**
9
 * Implements hook_uninstall().
10
 */
11
function flag_actions_uninstall() {
12
}
13

    
14
/**
15
 * Implements hook_schema().
16
 */
17
function flag_actions_schema() {
18
  $schema = array();
19

    
20
  $schema['flag_actions'] = array(
21
    'fields' => array(
22
      'aid' => array(
23
        'type' => 'serial',
24
        'not null' => TRUE,
25
        'disp-width' => '5',
26
      ),
27
      'fid' => array(
28
        'type' => 'int',
29
        'size' => 'small',
30
        'not null' => FALSE,
31
        'disp-width' => '5',
32
      ),
33
      'event' => array(
34
        'type' => 'varchar',
35
        'length' => '255',
36
        'not null' => FALSE,
37
      ),
38
      'threshold' => array(
39
        'type' => 'int',
40
        'size' => 'small',
41
        'not null' => TRUE,
42
        'default' => 0,
43
        'disp-width' => '5',
44
      ),
45
      'repeat_threshold' => array(
46
        'type' => 'int',
47
        'size' => 'small',
48
        'not null' => TRUE,
49
        'default' => 0,
50
        'disp-width' => '5',
51
      ),
52
      'callback' => array(
53
        'type' => 'varchar',
54
        'length' => '255',
55
        'not null' => TRUE,
56
        'default' => '',
57
      ),
58
      'parameters' => array(
59
        'type' => 'text',
60
        'size' => 'big',
61
        'not null' => TRUE,
62
      ),
63
    ),
64
    'primary key' => array('aid'),
65
  );
66

    
67
  return $schema;
68
}
69

    
70
/**
71
 * Add a "repeat_threshold" value to all existing Flag actions.
72
 */
73
function flag_actions_update_6200() {
74
  // Add the new repeat_threshold column.
75
  if (!db_field_exists('flag_actions', 'repeat_threshold')) {
76
    $column = array(
77
      'type' => 'int',
78
      'size' => 'small',
79
      'not null' => TRUE,
80
      'default' => 0,
81
      'disp-width' => '5',
82
    );
83
    db_add_field('flag_actions', 'repeat_threshold', $column);
84
  }
85

    
86
  // Update the normal threshold column to default to 0.
87
  $column = array(
88
    'type' => 'int',
89
    'size' => 'small',
90
    'not null' => TRUE,
91
    'default' => 0,
92
    'disp-width' => '5',
93
  );
94
  db_change_field('flag_actions', 'threshold', 'threshold', $column);
95
}