| 1 |
<?php
|
| 2 |
// $Id: flexifilter.install,v 1.6 2008/02/29 22:11:51 cwgordon7 Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function flexifilter_install() {
|
| 8 |
drupal_install_schema('flexifilter');
|
| 9 |
}
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_uninstall().
|
| 13 |
*/
|
| 14 |
function flexifilter_uninstall() {
|
| 15 |
drupal_uninstall_schema('flexifilter');
|
| 16 |
}
|
| 17 |
|
| 18 |
/**
|
| 19 |
* Implementation of hook_schema().
|
| 20 |
*/
|
| 21 |
function flexifilter_schema() {
|
| 22 |
$schema = array();
|
| 23 |
|
| 24 |
$schema['flexifilters'] = array(
|
| 25 |
'description' => t('Holds definitions for flexifilters.'),
|
| 26 |
'fields' => array(
|
| 27 |
'fid' => array(
|
| 28 |
'description' => t('The primary identifier for a flexifilter.'),
|
| 29 |
'type' => 'serial',
|
| 30 |
'unsigned' => TRUE,
|
| 31 |
'not null' => TRUE,
|
| 32 |
),
|
| 33 |
'label' => array(
|
| 34 |
'type' => 'varchar',
|
| 35 |
'length' => 127,
|
| 36 |
'not null' => TRUE,
|
| 37 |
'description' => t('Flexifilter human-readable name.'),
|
| 38 |
),
|
| 39 |
'description' => array(
|
| 40 |
'type' => 'varchar',
|
| 41 |
'length' => 255,
|
| 42 |
'not null' => TRUE,
|
| 43 |
'description' => t('Flexifilter filter tips.'),
|
| 44 |
),
|
| 45 |
'enabled' => array(
|
| 46 |
'type' => 'int',
|
| 47 |
'unsigned' => TRUE,
|
| 48 |
'size' => 'tiny',
|
| 49 |
'not null' => TRUE,
|
| 50 |
'default' => 0,
|
| 51 |
'description' => t('1 if the flexifilter is enabled, 0 otherwise'),
|
| 52 |
'disp-width' => '3',
|
| 53 |
),
|
| 54 |
'delta' => array(
|
| 55 |
'type' => 'int',
|
| 56 |
'size' => 'tiny',
|
| 57 |
'not null' => TRUE,
|
| 58 |
'disp-width' => '4',
|
| 59 |
'description' => t('Used to map Flexifilters to filters.'),
|
| 60 |
),
|
| 61 |
'pid_root' => array(
|
| 62 |
'type' => 'int',
|
| 63 |
'unsigned' => TRUE,
|
| 64 |
'not null' => FALSE,
|
| 65 |
'disp-width' => '10',
|
| 66 |
'description' => t('ID of a faux flexifilter part used as a parent for the root level components'),
|
| 67 |
),
|
| 68 |
'advanced' => array(
|
| 69 |
'type' => 'int',
|
| 70 |
'unsigned' => TRUE,
|
| 71 |
'size' => 'tiny',
|
| 72 |
'not null' => TRUE,
|
| 73 |
'disp-width' => '3',
|
| 74 |
'description' => t('1 if the flexifilter admin interface should display advanced settings for this flexifilter, 0 otherwise'),
|
| 75 |
),
|
| 76 |
'cache' => array(
|
| 77 |
'type' => 'int',
|
| 78 |
'unsigned' => TRUE,
|
| 79 |
'size' => 'tiny',
|
| 80 |
'not null' => TRUE,
|
| 81 |
'default' => 0,
|
| 82 |
'description' => t('1 if the flexifilter has caching enabled, 0 otherwise. Used for dynamic filters.'),
|
| 83 |
),
|
| 84 |
),
|
| 85 |
'primary key' => array('fid'),
|
| 86 |
'indexes' => array(
|
| 87 |
'delta' => array('delta'),
|
| 88 |
),
|
| 89 |
);
|
| 90 |
|
| 91 |
$schema['flexifilters_parts'] = array(
|
| 92 |
'description' => t('Holds definitions for individual flexifilter parts (components and conditions).'),
|
| 93 |
'fields' => array(
|
| 94 |
'pid' => array(
|
| 95 |
'type' => 'serial',
|
| 96 |
'unsigned' => TRUE,
|
| 97 |
'not null' => TRUE,
|
| 98 |
'disp-width' => '10',
|
| 99 |
'description' => t('Primary identifier for a flexifilter part.'),
|
| 100 |
),
|
| 101 |
'fid' => array(
|
| 102 |
'type' => 'int',
|
| 103 |
'unsigned' => TRUE,
|
| 104 |
'not null' => TRUE,
|
| 105 |
'disp-width' => '10',
|
| 106 |
'description' => t('ID of the flexifilter containing this part.'),
|
| 107 |
),
|
| 108 |
'parent_pid' => array(
|
| 109 |
'type' => 'int',
|
| 110 |
'unsigned' => TRUE,
|
| 111 |
'not null' => FALSE,
|
| 112 |
'disp-width' => '10',
|
| 113 |
'description' => t('ID of the flexifilter part that directly contains this part.'),
|
| 114 |
),
|
| 115 |
'type' => array(
|
| 116 |
'type' => 'int',
|
| 117 |
'unsigned' => TRUE,
|
| 118 |
'size' => 'tiny',
|
| 119 |
'not null' => TRUE,
|
| 120 |
'disp-width' => '3',
|
| 121 |
'description' => t('Type number of this part (component / condition / root)'),
|
| 122 |
),
|
| 123 |
'class_name' => array(
|
| 124 |
'type' => 'varchar',
|
| 125 |
'length' => '255',
|
| 126 |
'not null' => FALSE,
|
| 127 |
'description' => t('Class name of the component / condition'),
|
| 128 |
),
|
| 129 |
'settings' => array(
|
| 130 |
'type' => 'text',
|
| 131 |
'size' => 'big',
|
| 132 |
'not null' => TRUE,
|
| 133 |
'description' => t('Serialized array of any settings that have been set for this part'),
|
| 134 |
),
|
| 135 |
),
|
| 136 |
'primary key' => array('pid'),
|
| 137 |
'indexes' => array(
|
| 138 |
'fid' => array('fid'),
|
| 139 |
),
|
| 140 |
);
|
| 141 |
|
| 142 |
return $schema;
|
| 143 |
}
|
| 144 |
|
| 145 |
/**
|
| 146 |
* Update function: add the 'cache' field to the {flexifilters} table.
|
| 147 |
*/
|
| 148 |
function flexifilter_update_6100($ret) {
|
| 149 |
$table = 'flexifilters';
|
| 150 |
$field_name = 'cache';
|
| 151 |
$field_def = array(
|
| 152 |
'type' => 'int',
|
| 153 |
'unsigned' => TRUE,
|
| 154 |
'size' => 'tiny',
|
| 155 |
'not null' => TRUE,
|
| 156 |
'default' => 0,
|
| 157 |
'description' => t('1 if the flexifilter has caching enabled, 0 otherwise. Used for dynamic filters.'),
|
| 158 |
'initial' => 1,
|
| 159 |
);
|
| 160 |
db_add_field($ret, $table, $field_name, $field_def);
|
| 161 |
return $ret;
|
| 162 |
}
|