You are here

function mailsystem_requirements in Mail System 6.2

Same name and namespace in other branches
  1. 7.3 mailsystem.install \mailsystem_requirements()

Implements hook_requirements(). Ensures that the newly-required autoload module is available, or else disables the mailsystem module and returns an informative error message.

1 call to mailsystem_requirements()
mailsystem_update_6201 in ./mailsystem.install
Implements hook_update_N().

File

./mailsystem.install, line 28
Sets/deletes the 'smtp_library' variable as mailsystem is enabled/disabled.

Code

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