function phpmailer_requirements in PHPMailer 6.3
Same name and namespace in other branches
- 8.3 phpmailer.install \phpmailer_requirements()
- 5.2 phpmailer.install \phpmailer_requirements()
- 6.2 phpmailer.install \phpmailer_requirements()
- 7.4 phpmailer.install \phpmailer_requirements()
- 7.3 phpmailer.install \phpmailer_requirements()
Implementation of hook_requirements().
File
- ./
phpmailer.install, line 11 - PHPMailer installation functions.
Code
function phpmailer_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time.
$t = get_t();
if ($phase == 'runtime' && phpmailer_load_library()) {
$mail = new PHPMailer();
$requirements['phpmailer'] = array(
'title' => $t('PHPMailer library'),
'value' => $mail->Version,
'severity' => REQUIREMENT_OK,
);
}
else {
drupal_load('module', 'libraries');
$path = libraries_get_path('phpmailer');
if (!file_exists('./' . $path . '/class.phpmailer.php') || !file_exists('./' . $path . '/class.smtp.php')) {
$requirements['phpmailer'] = array(
'title' => $t('PHPMailer library'),
'value' => $t('Missing'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('Please download <a href="@url">PHPMailer for PHP5/6</a>, extract the archive and copy the contents to the following location:<br /><code>@path</code>. Make sure the main file, class.phpmailer.php, is located at<br /><code>@class</code>.', array(
'@url' => 'https://github.com/PHPMailer/PHPMailer/tags',
'@path' => $path,
'@class' => $path . '/class.phpmailer.php',
)),
);
}
}
return $requirements;
}