71 lines
1.6 KiB
Plaintext
71 lines
1.6 KiB
Plaintext
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Install, update and uninstall functions for the Mailgun module.
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_uninstall().
|
|
*/
|
|
function mailgun_uninstall() {
|
|
// Delete variables.
|
|
$variables = array(
|
|
'mailgun_api_key',
|
|
'mailgun_from_action',
|
|
'mailgun_from_name',
|
|
'mailgun_from_mail',
|
|
'mailgun_tracking',
|
|
'mailgun_tracking_clicks',
|
|
'mailgun_tracking_opens',
|
|
'mailgun_queue',
|
|
'mailgun_log',
|
|
'mailgun_format',
|
|
'mailgun_tagging_mailkey',
|
|
);
|
|
foreach ($variables as $variable) {
|
|
variable_del($variable);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_enable().
|
|
*/
|
|
function mailgun_enable() {
|
|
mailsystem_set(array('mailgun_test' => 'MailgunMailSystem'));
|
|
}
|
|
|
|
/**
|
|
* Implements hook_disable().
|
|
*/
|
|
function mailgun_disable() {
|
|
// Tell Mail System to remove Mailgun and restore to defaults.
|
|
mailsystem_clear(array('mailgun_test' => 'MailgunMailSystem'));
|
|
watchdog('mailgun', 'Mailgun has been disabled.');
|
|
}
|
|
|
|
/**
|
|
* Implements hook_requirements().
|
|
*/
|
|
function mailgun_requirements($phase) {
|
|
// Ensure translations don't break during installation.
|
|
$t = get_t();
|
|
|
|
$requirements = array();
|
|
|
|
if ($phase === 'runtime') {
|
|
$requirements['mailgun']['title'] = $t('Mailgun');
|
|
|
|
if (mailgun_check_library()) {
|
|
$requirements['mailgun']['value'] = $t('The Mailgun library is installed correctly.');
|
|
$requirements['mailgun']['severity'] = REQUIREMENT_OK;
|
|
}
|
|
else {
|
|
$requirements['mailgun']['value'] = $t('The Mailgun library has not been installed correctly.');
|
|
$requirements['mailgun']['severity'] = REQUIREMENT_ERROR;
|
|
}
|
|
}
|
|
|
|
return $requirements;
|
|
}
|