function phpmailer_requirements in PHPMailer 5.2
Same name and namespace in other branches
- 8.3 phpmailer.install \phpmailer_requirements()
- 6.3 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();
$path = drupal_get_path('module', 'phpmailer');
if (!file_exists('./' . $path . '/phpmailer/class.phpmailer.php') || !file_exists('./' . $path . '/phpmailer/class.smtp.php')) {
$requirements['phpmailer'] = array(
'title' => $t('PHPMailer library'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('PHPMailer module requires the <a href="@phpmailer-url">PHPMailer</a> library to properly send mail. Please download the PHPMailer package for PHP5/6, extract the archive and copy its contents to the following location: @phpmailer-path. Make sure the main PHPMailer class is located at @phpmailer-class-path.', array(
'@phpmailer-url' => 'http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/',
'@phpmailer-path' => $path . '/phpmailer/',
'@phpmailer-class-path' => $path . '/phpmailer/class.phpmailer.php',
)),
);
}
else {
if ($phase == 'runtime') {
require_once drupal_get_path('module', 'phpmailer') . '/phpmailer/class.phpmailer.php';
$mail = new PHPMailer();
$requirements['phpmailer'] = array(
'title' => $t('PHPMailer library'),
'value' => $mail->Version,
'severity' => REQUIREMENT_OK,
);
}
}
return $requirements;
}