You are here

function acquia_search_requirements in Acquia Search 6

Same name and namespace in other branches
  1. 6.3 acquia_search.install \acquia_search_requirements()
  2. 3.x acquia_search.install \acquia_search_requirements()
  3. 2.x acquia_search.install \acquia_search_requirements()

Implementation of hook_requirements().

File

./acquia_search.install, line 7

Code

function acquia_search_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break at install time
  $t = get_t();

  // Skip install checks if install.php is running. The weak install profile
  // API means install.php calls hook_requirements for every module in a profile.
  if ($phase == 'install' && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'install')) {
    if (module_invoke('acquia_agent', 'has_credentials')) {
      $severity = REQUIREMENT_OK;
    }
    else {
      $severity = REQUIREMENT_ERROR;
    }
    $requirements['acquia_search_credentials'] = array(
      'description' => $t('In order to use Acquia search module you must have an Acquia Network subscription. Please enter your Acquia Network subscription keys.'),
      'severity' => $severity,
    );
    require_once drupal_get_path('module', 'acquia_agent') . '/acquia_agent_streams.inc';
    $requirements['acquia_connector_https'] = array(
      'description' => $t('Your version of the Acquia Agent module in the Acquia Network Connector package is out of date.  You must have version 6.x-1.1 to install Acquia Search.'),
      'severity' => function_exists('acquia_agent_stream_context_create') ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    );
  }

  // Check SSL support.
  if (in_array('ssl', stream_get_transports(), TRUE)) {
    $severity = REQUIREMENT_OK;
    $requirements['acquia_search'] = array(
      'description' => $t('The Acquia Search module is using SSL to protect the privacy of your content.'),
    );
  }
  else {
    $severity = REQUIREMENT_WARNING;
    $requirements['acquia_search'] = array(
      'description' => $t('In order to protect the privacy of your content with the Acquia Search module you must have SSL support enabled in PHP on your host.'),
    );
  }
  $requirements['acquia_search']['title'] = $t('Acquia Search');
  $requirements['acquia_search']['severity'] = $severity;
  return $requirements;
}