-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmailjet.install
45 lines (39 loc) · 1.25 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
<?php
/**
* @file
* Install, update and uninstall functions for the Mailjet Module.
*/
/**
* Implements hook_requirements().
*/
function mailjet_requirements($phase) {
$requirements = [];
if ($phase == 'install') {
$errorData = [
'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.',
[
'@phpmailer' => 'https://github.com/PHPMailer/PHPMailer/archive/v6.0.7.zip',
'%path' => 'libraries/phpmailer',
]
),
];
if (file_exists('libraries/phpmailer/src/PHPMailer.php')) {
require_once 'libraries/phpmailer/src/PHPMailer.php';
} elseif (file_exists('../vendor/phpmailer/phpmailer/src/PHPMailer.php')) {
require_once '../vendor/phpmailer/phpmailer/src/PHPMailer.php';
} else {
$requirements['phpmailer'] = $errorData;
}
}
return $requirements;
}
/**
* Implements hook_uninstall().
*/
function mailjet_uninstall() {
$config = \Drupal::getContainer()
->get('config.factory')
->getEditable('system.mail');
$config->set('interface.default', 'php_mail')->save();
}