You are here

acquia_search.install in Acquia Search 6.3

File

acquia_search.install
View source
<?php

/**
 * Implementation of hook_requirements().
 */
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,
      'value' => '',
    );
  }
  if ($phase == 'runtime') {

    // Check SSL support.
    if (in_array('ssl', stream_get_transports(), TRUE)) {
      $severity = REQUIREMENT_OK;
      $requirements['acquia_search_ssl'] = array(
        'description' => $t('The Acquia Search module is using SSL to protect the privacy of your content.'),
      );
    }
    else {
      $severity = REQUIREMENT_WARNING;
      $requirements['acquia_search_ssl'] = 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_ssl']['title'] = $t('Acquia Search');
    $requirements['acquia_search_ssl']['severity'] = $severity;
    $requirements['acquia_search_ssl']['value'] = '';

    // Check Apache Solr API version.
    if (!defined('APACHESOLR_API_VERSION') || version_compare(APACHESOLR_API_VERSION, '3.0', '<')) {
      $requirements['acquia_search_apachesolr']['title'] = $t('Acquia Search');
      $requirements['acquia_search_apachesolr']['severity'] = REQUIREMENT_ERROR;
      $requirements['acquia_search_apachesolr']['description'] = $t('Apache Solr API Integration requires  API version 3.0.  Please upgrade your Apache Solr Search Integration module');
      $requirements['acquia_search_apachesolr']['value'] = $t('Incompatible API version');
    }
  }

  // Update the cached version whenever we may be updating the module.
  // We cannot run it on the update phase since Drupal 6 only executes an
  // update phase for the system module. For Drupal 6 we moved it to cron
  // this phase will run on the following paths : 'admin', 'admin/by-task',
  // 'admin/reports/status'.
  if ($phase == 'runtime') {
    _acquia_search_set_version();
  }
  return $requirements;
}

/**
 * Implementation of hook_install().
 */
function acquia_search_install() {

  // No need to set apachesolr_service_class for Acquia, since each
  // environment can have a separate class.
  $class = variable_get('apachesolr_service_class', '');
  if ($class && strpos($class, 'Acquia') === 0) {
    variable_del('apachesolr_service_class');
  }
}

/**
 * Implementation of hook_uninstall().
 */
function acquia_search_uninstall() {
  variable_del('acquia_search_version');
  variable_del('acquia_search_edismax_default');
  variable_del('acquia_search_path');
  variable_del('acquia_search_base_url');
  variable_del('acquia_search_derived_key_salt');
}

/**
 * Removing acquia_search_url variable as it has been split up
 * to acquia_search_base_url and acquia_search_path
 */
function acquia_search_update_6300() {
  $ret = array();

  // Reset some variables
  variable_del('acquia_search_host');
  variable_del('acquia_search_port');
  variable_del('acquia_search_path');
  variable_del('acquia_search_url');

  // No need to set apachesolr_service_class for Acquia, since each
  // environment can have a separate class.
  $class = variable_get('apachesolr_service_class', '');
  if ($class && strpos($class, 'Acquia') === 0) {
    variable_del('apachesolr_service_class');
  }
  return $ret;
}

Functions

Namesort descending Description
acquia_search_install Implementation of hook_install().
acquia_search_requirements Implementation of hook_requirements().
acquia_search_uninstall Implementation of hook_uninstall().
acquia_search_update_6300 Removing acquia_search_url variable as it has been split up to acquia_search_base_url and acquia_search_path