From 99b9ebcd1767ad4eedf8a1917d0b1bd25fc535cb Mon Sep 17 00:00:00 2001
From: alanmackenzie <alanmackenzie@1045032.no-reply.drupal.org>
Date: Tue, 2 Apr 2013 17:23:59 +0100
Subject: [PATCH] Issue #1689778: "Support the ability to connect to more than
 one subscription"

Added the persistent variable search_api_acquia_path, which allows you
to switch solr paths based on environment.
---
 includes/SearchApiAcquiaSearchService.php |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/includes/SearchApiAcquiaSearchService.php b/includes/SearchApiAcquiaSearchService.php
index ca19cef..24f9bb9 100644
--- a/includes/SearchApiAcquiaSearchService.php
+++ b/includes/SearchApiAcquiaSearchService.php
@@ -18,6 +18,7 @@ class SearchApiAcquiaSearchService extends SearchApiSolrService {
       if (!class_exists('Apache_Solr_Service')) {
         throw new Exception(t('SolrPhpClient library not found! Please follow the instructions in search_api_solr/INSTALL.txxt for installing the Solr search module.'));
       }
+      $this->options['path'] = variable_get('search_api_acquia_path', $this->options['path']);
       $this->solr = new SearchApiAcquiaSearchConnection($this->options);
     }
   }
@@ -38,6 +39,8 @@ class SearchApiAcquiaSearchService extends SearchApiSolrService {
       'modify_acquia_connection' => FALSE,
     );

+    $options['path'] = variable_get('search_api_acquia_path', $options['path']);
+
     // HTTP authentication is not needed since Acquia Search uses an HMAC
     // authentication mechanism.
     $form['http']['#access'] = FALSE;
@@ -76,7 +79,9 @@ class SearchApiAcquiaSearchService extends SearchApiSolrService {

     // We cannot connect directly to the Solr instance, so don't make it a link.
     if (isset($form['server_description'])) {
-      $url = 'http://' . $this->options['host'] . ':' . $this->options['port'] . $this->options['path'];
+      $url = 'http://' . $this->options['host'] . ':' .
+        $this->options['port'] .
+        variable_get('search_api_acquia_path', $this->options['path']);
       $form['server_description'] = array(
         '#type' => 'item',
         '#title' => t('Acquia Search URI'),
--
1.7.9.5

