Commit bc5eff21 authored by Bohdan Artemchuk's avatar Bohdan Artemchuk Committed by Bohdan Artemchuk
Browse files

Issue #3261259 by boddy, bohart: Updated hook_requirements to use autoloaded PHPMailer class.

parent d68a25b1
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
 * Install, update and uninstall functions for the Mailjet Module.
 */

use PHPMailer\PHPMailer\PHPMailer;

/**
 * Implements hook_requirements().
@@ -12,13 +13,8 @@
function mailjet_requirements($phase) {
  $requirements = [];

  if ($phase == 'install') {

    if (class_exists('PHPMailer')) {
      $mail = new PHPMailer();
    }

    if (empty($mail)) {
  if ($phase === 'install') {
    if (!class_exists(PHPMailer::class)) {
      $requirements['mailjet'] = [
        'title' => (string) t('PHPMailer library'),
        'value' => (string) t('Missing'),
@@ -28,7 +24,7 @@ function mailjet_requirements($phase) {
    }
    else {
      $required_version = '6.0.7';
      $installed_version = $mail->Version;
      $installed_version = PHPMailer::VERSION;
      $requirements['mailjet'] = [
        'title' => (string) t('PHPMailer library'),
        'value' => $installed_version,