You are here

function mimemail_requirements in Mime Mail 7

Same name and namespace in other branches
  1. 6 mimemail.install \mimemail_requirements()

Implements hook_requirements().

Ensures that the newly-required Mail System module is available, or else disables the Mime Mail module and returns an informative error message.

1 call to mimemail_requirements()
mimemail_update_7000 in ./mimemail.install
Check installation requirements.

File

./mimemail.install, line 61
Install, update and uninstall functions for Mime Mail module.

Code

function mimemail_requirements($phase) {
  if ($phase === 'install' || module_exists('mailsystem')) {
    return array();
  }
  $args = array(
    '!mailsystem' => url('http://drupal.org/project/mailsystem'),
    '%mailsystem' => 'Mail System',
    '!mimemail' => url('http://drupal.org/project/mimemail'),
    '%mimemail' => 'Mime Mail',
  );
  if (module_enable(array(
    'mailsystem',
  )) && module_load_include('module', 'mailsystem')) {
    drupal_set_message(t('The %mailsystem module has been enabled because the %mimemail module now requires it.', $args));
    return array();
  }
  return array(
    'mimemail_mailsystem' => array(
      'title' => t('%mailsystem module', $args),
      'value' => t('Not installed'),
      'description' => t('The <a href="!smtp">%mimemail</a> module dependencies have changed.  Please download and install the required <a href="!mailsystem">%mailsystem</a> module, then re-enable the <a href="!mimemail">%mimemail</a> module.', $args),
      'severity' => REQUIREMENT_ERROR,
    ),
  );
}