form_builder.install in Form Builder 7
File
form_builder.install
View source
<?php
function form_builder_uninstall() {
$result = db_query("SELECT name FROM {variable} WHERE name LIKE 'form_builder_%'");
foreach ($result as $row) {
variable_del($row->name);
}
}
function form_builder_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'runtime') {
$form_builder_types = module_invoke_all('form_builder_form_types');
if (empty($form_builder_types)) {
$requirements['form_builder_types']['title'] = $t('Form builder');
$requirements['form_builder_types']['severity'] = REQUIREMENT_ERROR;
$requirements['form_builder_types']['value'] = $t('No dependent modules found.');
$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.');
}
}
return $requirements;
}
function form_builder_update_7000() {
$spec = array(
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
);
db_change_field('form_builder_cache', 'data', 'data', $spec);
}
function form_builder_update_7001() {
$spec = array(
'type' => 'varchar',
'length' => '128',
'not null' => FALSE,
);
db_change_field('form_builder_cache', 'form_id', 'form_id', $spec);
}
function form_builder_update_7002() {
module_enable(array(
'ctools',
));
$sql = <<<SQL
INSERT INTO {ctools_object_cache}
(sid, name, obj, updated, data)
SELECT l.sid, 'form_builder_cache', CONCAT(l.type, ':', l.form_id), l.updated, l.data
FROM {form_builder_cache} l
LEFT OUTER JOIN {form_builder_cache} r ON l.sid=r.sid AND l.type=r.type AND l.form_id=r.form_id AND l.updated<r.updated
WHERE r.sid IS NULL
SQL;
db_query($sql);
db_drop_table('form_builder_cache');
}