background_process.install in Background Process 7.2
Same filename and directory in other branches
This is the installation file for the Background Process module
File
background_process.installView source
<?php
/**
* @file
* This is the installation file for the Background Process module
*/
/**
* Implements of hook_enable().
*/
function background_process_enable() {
$_SESSION['background_process_determine_default_service_host'] = TRUE;
}
/**
* Implements of hook_schema().
*/
function background_process_schema() {
$schema = array();
$schema['background_process'] = array(
'fields' => array(
'pid' => array(
'type' => 'serial',
'size' => 'big',
),
'handle' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'token' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'uid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'callback' => array(
'type' => 'blob',
'size' => 'big',
'not null' => FALSE,
),
'arguments' => array(
'type' => 'blob',
'size' => 'big',
'not null' => FALSE,
),
'options' => array(
'type' => 'blob',
'size' => 'big',
'not null' => FALSE,
),
'service_group' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'service_host' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'keepalive' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
'progress' => array(
'type' => 'float',
'size' => 'big',
'not null' => TRUE,
'default' => -1,
),
'progress_message' => array(
'type' => 'blob',
'size' => 'big',
'not null' => FALSE,
),
'created' => array(
'type' => 'numeric',
'precision' => '16',
'scale' => '6',
'not null' => TRUE,
'default' => 0,
),
'start_stamp' => array(
'type' => 'numeric',
'precision' => '16',
'scale' => '6',
'not null' => TRUE,
'default' => 0,
),
'exec_status' => array(
'type' => 'int',
'size' => 'normal',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'pid',
),
'unique keys' => array(
'uni_handle' => array(
'handle',
),
),
'indexes' => array(
'idx_created' => array(
'created',
),
'idx_start' => array(
'start_stamp',
),
),
);
$schema['background_process_result'] = array(
'fields' => array(
'pid' => array(
'type' => 'int',
'size' => 'normal',
'default' => 0,
'not null',
),
'result' => array(
'type' => 'blob',
'size' => 'big',
'not null' => FALSE,
),
'created' => array(
'type' => 'int',
'size' => 'normal',
'default' => 0,
'not null',
),
),
'primary key' => array(
'pid',
),
'indexes' => array(
'idx_created' => array(
'created',
),
),
);
return $schema;
}
/**
* Implements hook_uninstall().
*/
function background_process_uninstall() {
// Removing process variables.
variable_del('background_process_service_timeout');
variable_del('background_process_connection_timeout');
variable_del('background_process_stream_timeout');
variable_del('background_process_cleanup_age');
variable_del('background_process_running_cleanup_age');
variable_del('background_process_queue_cleanup_age');
variable_del('background_process_result_cleanup_age');
variable_del('background_process_default_service_group');
variable_del('background_process_default_service_host');
variable_del('background_process_derived_default_host');
variable_del('background_process_token');
}
/**
* Quick'n'dirty upgrade path
*/
function background_process_update_7200() {
db_drop_table('background_process');
drupal_install_schema('background_process');
}
Functions
Name | Description |
---|---|
background_process_enable | Implements of hook_enable(). |
background_process_schema | Implements of hook_schema(). |
background_process_uninstall | Implements hook_uninstall(). |
background_process_update_7200 | Quick'n'dirty upgrade path |