You are here

function messaging_update_6002 in Messaging 6.3

Same name and namespace in other branches
  1. 6.4 messaging.install \messaging_update_6002()
  2. 6 messaging.install \messaging_update_6002()
  3. 6.2 messaging.install \messaging_update_6002()

Update sending methods names

File

./messaging.install, line 276

Code

function messaging_update_6002() {
  $ret = array();
  module_load_all();
  if (module_exists('messaging_phpmailer')) {
    $replace['html_mail'] = 'phpmailer';
  }
  if (module_exists('messaging_mime_mail') && !module_exists('messaging_mail')) {
    $replace['mail'] = 'mimemail';
  }
  if (!empty($replace)) {
    foreach ($replace as $old => $new) {
      if ($settings = variable_get('messaging_method_' . $old, NULL)) {
        variable_set('messaging_method_' . $new, $settings);
        variable_del('messaging_method_' . $old);
      }
      messaging_update_method_update($old, $new);
      $ret[] = array(
        'success' => TRUE,
        'query' => "Replaced sending method {$old} by {$new}",
      );
    }
    drupal_set_message('Please, check all your messaging settings for sending methods.');
  }
  return $ret;
}