| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function form_builder_install() {
|
| 8 |
drupal_install_schema('form_builder');
|
| 9 |
}
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_uninstall().
|
| 13 |
*/
|
| 14 |
function form_builder_uninstall() {
|
| 15 |
drupal_uninstall_schema('form_builder');
|
| 16 |
$result = db_query("SELECT name FROM {variable} WHERE name LIKE 'form_builder_%'");
|
| 17 |
while ($row = db_fetch_object($result)) {
|
| 18 |
variable_del($row->name);
|
| 19 |
}
|
| 20 |
}
|
| 21 |
|
| 22 |
/**
|
| 23 |
* Implementation of hook_requirements().
|
| 24 |
*/
|
| 25 |
function form_builder_requirements($phase) {
|
| 26 |
$requirements = array();
|
| 27 |
$t = get_t();
|
| 28 |
if ($phase == 'runtime') {
|
| 29 |
$form_builder_types = module_invoke_all('form_builder_types');
|
| 30 |
if (empty($form_builder_types)) {
|
| 31 |
$requirements['form_builder_types']['title'] = $t('Form builder');
|
| 32 |
$requirements['form_builder_types']['severity'] = REQUIREMENT_ERROR;
|
| 33 |
$requirements['form_builder_types']['description'] = t('Form builder module is installed but no modules implement support for it. You may want to disable Form builder module until it is needed.');
|
| 34 |
}
|
| 35 |
}
|
| 36 |
|
| 37 |
return $requirements;
|
| 38 |
}
|
| 39 |
|
| 40 |
/**
|
| 41 |
* Implementation of hook_schema().
|
| 42 |
*/
|
| 43 |
function form_builder_schema() {
|
| 44 |
$schema = array();
|
| 45 |
|
| 46 |
$schema['form_builder_cache'] = array(
|
| 47 |
'fields' => array(
|
| 48 |
'sid' => array(
|
| 49 |
'type' => 'varchar',
|
| 50 |
'length' => '64',
|
| 51 |
'not null' => FALSE,
|
| 52 |
),
|
| 53 |
'form_id' => array(
|
| 54 |
'type' => 'varchar',
|
| 55 |
'length' => '32',
|
| 56 |
'not null' => FALSE,
|
| 57 |
),
|
| 58 |
'type' => array(
|
| 59 |
'type' => 'varchar',
|
| 60 |
'length' => '32',
|
| 61 |
'not null' => FALSE,
|
| 62 |
),
|
| 63 |
'updated' => array(
|
| 64 |
'type' => 'int',
|
| 65 |
'unsigned' => TRUE,
|
| 66 |
'not null' => TRUE,
|
| 67 |
'default' => 0,
|
| 68 |
'disp-width' => '10',
|
| 69 |
),
|
| 70 |
'data' => array(
|
| 71 |
'type' => 'blob',
|
| 72 |
'not null' => FALSE,
|
| 73 |
),
|
| 74 |
),
|
| 75 |
'indexes' => array(
|
| 76 |
'sid_obj_name' => array('sid', 'type', 'form_id'),
|
| 77 |
'updated' => array('updated'),
|
| 78 |
),
|
| 79 |
);
|
| 80 |
|
| 81 |
|
| 82 |
return $schema;
|
| 83 |
}
|