96 lines
2.0 KiB
Plaintext
96 lines
2.0 KiB
Plaintext
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Flag actions install file.
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_uninstall().
|
|
*/
|
|
function flag_actions_uninstall() {
|
|
}
|
|
|
|
/**
|
|
* Implements hook_schema().
|
|
*/
|
|
function flag_actions_schema() {
|
|
$schema = array();
|
|
|
|
$schema['flag_actions'] = array(
|
|
'fields' => array(
|
|
'aid' => array(
|
|
'type' => 'serial',
|
|
'not null' => TRUE,
|
|
'disp-width' => '5',
|
|
),
|
|
'fid' => array(
|
|
'type' => 'int',
|
|
'size' => 'small',
|
|
'not null' => FALSE,
|
|
'disp-width' => '5',
|
|
),
|
|
'event' => array(
|
|
'type' => 'varchar',
|
|
'length' => '255',
|
|
'not null' => FALSE,
|
|
),
|
|
'threshold' => array(
|
|
'type' => 'int',
|
|
'size' => 'small',
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
'disp-width' => '5',
|
|
),
|
|
'repeat_threshold' => array(
|
|
'type' => 'int',
|
|
'size' => 'small',
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
'disp-width' => '5',
|
|
),
|
|
'callback' => array(
|
|
'type' => 'varchar',
|
|
'length' => '255',
|
|
'not null' => TRUE,
|
|
'default' => '',
|
|
),
|
|
'parameters' => array(
|
|
'type' => 'text',
|
|
'size' => 'big',
|
|
'not null' => TRUE,
|
|
),
|
|
),
|
|
'primary key' => array('aid'),
|
|
);
|
|
|
|
return $schema;
|
|
}
|
|
|
|
/**
|
|
* Add a "repeat_threshold" value to all existing Flag actions.
|
|
*/
|
|
function flag_actions_update_6200() {
|
|
// Add the new repeat_threshold column.
|
|
if (!db_field_exists('flag_actions', 'repeat_threshold')) {
|
|
$column = array(
|
|
'type' => 'int',
|
|
'size' => 'small',
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
'disp-width' => '5',
|
|
);
|
|
db_add_field('flag_actions', 'repeat_threshold', $column);
|
|
}
|
|
|
|
// Update the normal threshold column to default to 0.
|
|
$column = array(
|
|
'type' => 'int',
|
|
'size' => 'small',
|
|
'not null' => TRUE,
|
|
'default' => 0,
|
|
'disp-width' => '5',
|
|
);
|
|
db_change_field('flag_actions', 'threshold', 'threshold', $column);
|
|
}
|