sendinblue.install in SendinBlue 7
Same filename and directory in other branches
Install, update and uninstall functions for the sendinblue module.
File
sendinblue.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the sendinblue module.
*/
/**
* Implements hook_schema().
*/
function sendinblue_schema() {
$schema['sendinblue_signup'] = array(
'fields' => array(
'mcsId' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique sendinblue_signup entity ID.',
),
'name' => array(
'description' => 'The machine-readable name of this sendinblue_signup.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'mcLists' => array(
'type' => 'blob',
'not null' => TRUE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized array of list IDs with list-specific configuration.',
),
'mode' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'Signifies the display mode for this signup form.',
),
'title' => array(
'type' => 'varchar',
'length' => 32,
'description' => 'The {sendinblue_lists}.label of this sendinblue_list.',
'not null' => TRUE,
'default' => '',
),
'settings' => array(
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
'description' => 'A serialized object that stores the settings for the specific list.',
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
// Set the default to ENTITY_CUSTOM without using the constant as it is
// not safe to use it at this point.
'default' => 0x1,
'size' => 'tiny',
'description' => 'The exportable status of the entity.',
),
'module' => array(
'description' => 'The name of the providing module if the entity has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'primary key' => array(
'mcsId',
),
'unique key' => array(
'name',
),
);
$schema['sendinblue_contact'] = array(
'fields' => array(
'sc_id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique sendinblue_contact entity ID.',
),
'email' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'Unique Key: Unique the email of a subscriber.',
),
'info' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'All information of a subscriber.',
),
'code' => array(
'type' => 'varchar',
'length' => 100,
'not null' => TRUE,
'description' => 'Unique identifier for a subscriber on frontend.',
),
'is_active' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
),
),
'primary key' => array(
'sc_id',
),
'unique key' => array(
'email',
),
);
return $schema;
}
/**
* Implements hook_uninstall().
*/
function sendinblue_uninstall() {
variable_del('sendinblue_access_key');
variable_del('sendinblue_account_email');
variable_del('sendinblue_account_username');
variable_del('sendinblue_account_data');
variable_del('sendinblue_access_token');
variable_del('sendinblue_attribute_lists');
variable_del('sendinblue_smtp_details');
variable_del('sendinblue_on');
variable_del('sendinblue_debug');
$queue = DrupalQueue::get('sendinblue');
$queue
->deleteQueue();
$queue = DrupalQueue::get('sendinblue_batch');
$queue
->deleteQueue();
}
/**
* Implements hook_requirements().
*/
function sendinblue_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time:
$t = get_t();
$has_curl = function_exists('curl_init');
if (!$has_curl) {
$requirements['sendinblue'] = array(
'title' => $t('SendinBlue'),
'description' => $t('SendinBlue module could not be installed because the PHP <a href="@curl_url">cURL</a> library in not available', array(
'@curl_url' => 'http://php.net/manual/curl.setup.php',
)),
'severity' => REQUIREMENT_ERROR,
);
}
return $requirements;
}
Functions
Name | Description |
---|---|
sendinblue_requirements | Implements hook_requirements(). |
sendinblue_schema | Implements hook_schema(). |
sendinblue_uninstall | Implements hook_uninstall(). |