You are here

function phpmailer_uninstall in PHPMailer 8.3

Same name and namespace in other branches
  1. 5.2 phpmailer.install \phpmailer_uninstall()
  2. 6.3 phpmailer.install \phpmailer_uninstall()
  3. 6 phpmailer.install \phpmailer_uninstall()
  4. 6.2 phpmailer.install \phpmailer_uninstall()
  5. 7.4 phpmailer.install \phpmailer_uninstall()
  6. 7.3 phpmailer.install \phpmailer_uninstall()

Implementation of hook_uninstall().

File

./phpmailer.install, line 70
PHPMailer installation functions.

Code

function phpmailer_uninstall() {

  /**
   *  @todo This part needs to be figured out.
   */

  //  $mail_system = variable_get('mail_system', ['default-system' => 'DefaultMailSystem']);
  //  $mail_system['default-system'] = 'DefaultMailSystem';
  //  variable_set('mail_system', $mail_system);
  if (phpmailer_active()) {

    // Remove PHPMailer from all mail keys it is configured for.
    //    $mail_system = variable_get('mail_system', ['default-system' => 'DefaultMailSystem']);
    //    foreach ($mail_system as $key => $class) {
    //      if ($class == 'DrupalPHPMailer') {
    //        if ($key != 'default-system') {
    //          unset($mail_system[$key]);
    //        }
    //        else {
    //          $mail_system[$key] = 'DefaultMailSystem';
    //        }
    //      }
    //    }
    //    variable_set('mail_system', $mail_system);
    \Drupal::configFactory()
      ->getEditable('phpmailer.settings')
      ->clear('smtp_on')
      ->save();
    drupal_set_message(t('PHPMailer has been disabled.'));
  }

  /**
   *  @todo Need to find out where this variable comes from.
   */

  //  if (\Drupal::moduleHandler()->moduleExists('mimemail') && variable_get('mimemail_engine', 'mimemail') == 'phpmailer') {
  // This variable does not exist in the D8 port of Mime Mail.
  //    variable_del('mimemail_engine');
  //    drupal_set_message(t('MimeMail e-mail engine has been reset to default.'), 'warning');
  //  }
  if (\Drupal::moduleHandler()
    ->moduleExists('mailsystem')) {

    // This function does not exist in the D8 port of Mail System.
    //    mailsystem_clear(['phpmailer' => 'DrupalPHPMailer']);
  }
}