You are here

function apachesolr_load_service_class in Apache Solr Search 6.3

5 calls to apachesolr_load_service_class()
apachesolr_get_solr in ./apachesolr.module
Factory method for solr singleton objects. Structure allows for an arbitrary number of solr objects to be used based on a name whie maps to the host, port, path combination. Get an instance like this: try { $solr = apachesolr_get_solr(); } catch…
apachesolr_server_status in ./apachesolr.module
Checks if a specific Apache Solr server is available.
DrupalApacheSolrNodeAccess::setUp in apachesolr_access/tests/apachesolr_access.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
DrupalSolrNodeTestCase::setUp in tests/apachesolr_base.test
Implementation of setUp().
DrupalSolrOfflineSearchPagesWebTestCase::setUp in tests/apachesolr_base.test
Implementation of setUp().

File

./apachesolr.module, line 1164
Integration with the Apache Solr search application.

Code

function apachesolr_load_service_class($class = NULL, $class_info = NULL) {
  if (!interface_exists('DrupalApacheSolrServiceInterface')) {
    require_once dirname(__FILE__) . '/apachesolr.interface.inc';
  }

  // Use the default class if none is specified.
  if (!is_array($class_info) || !isset($class)) {
    $class_info = variable_get('apachesolr_service_class', array(
      'file' => 'Drupal_Apache_Solr_Service',
      'module' => 'apachesolr',
      'class' => 'DrupalApacheSolrService',
    ));
    $class = $class_info['class'];
  }

  // If class is already loaded, do nothing
  if (class_exists($class)) {
    return $class;
  }
  if (isset($class_info['file']) && isset($class_info['module'])) {
    $loaded = module_load_include('php', $class_info['module'], $class_info['file']);
    if ($loaded === FALSE) {
      throw new Exception('Could not load defined service class: ' . $class);
    }
  }
  return $class;
}