-
Notifications
You must be signed in to change notification settings - Fork 4
/
mailjet.install
78 lines (71 loc) · 2.02 KB
/
mailjet.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* @file
* Functions called while installing, uninstalling or activation of the module.
*/
/**
* Implements hook_install().
*/
function mailjet_install() {
variable_set('mailjet_debug', FALSE);
cache_clear_all();
}
/**
* Implements hook_uninstall().
*/
function mailjet_uninstall() {
variable_del('mailjet_from');
variable_del('mailjet_host');
variable_del('mailjet_on');
variable_del('mailjet_password');
variable_del('mailjet_port');
variable_del('mailjet_protocol');
variable_del('mailjet_test');
variable_del('mailjet_test_address');
variable_del('mailjet_username');
variable_del('mailjet_allowhtml');
variable_del('mailjet_debug');
}
/**
* Implements hook_disable().
*/
function mailjet_disable() {
variable_set('mailjet_on', FALSE);
variable_set('mail_system', array('default-system' => 'DefaultMailSystem'));
}
/**
* Implements hook_update().
*/
function mailjet_update_7000() {
if (variable_get('mailjet_on', FALSE)) {
variable_set('mail_system', array('default-system' => 'MailjetSmtpMailSystem'));
}
cache_clear_all();
}
/**
* Implements hook_requirements().
*/
function mailjet_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'install') {
$error_data = array(
'severity' => REQUIREMENT_ERROR,
'description' => $t('Mailjet module requires the <a href="@phpmailer">PHPMailer Library</a>, which is missing. Download and extract the entire contents of the archive into the %path directory on your server.', array(
'@phpmailer' => 'http://github.com/PHPMailer/PHPMailer/archive/v5.2.21.zip',
'%path' => 'sites/all/libraries/phpmailer'
)
),
);
if (function_exists('libraries_get_path')) {
$phpmailer_path = libraries_get_path('phpmailer');
if (!$phpmailer_path) {
$requirements['phpmailer'] = $error_data;
}
}
elseif (!file_exists('sites/all/libraries/phpmailer/PHPMailerAutoload.php')) {
$requirements['phpmailer'] = $error_data;
}
}
return $requirements;
}