You are here

function search_api_elasticsearch_elastica_loaded in Search API Elasticsearch 7

Check if the Elastica library is loaded.

Return value

bool Returns TRUE if loaded.

1 call to search_api_elasticsearch_elastica_loaded()
SearchApiElasticsearchElastica::__construct in modules/elastica/includes/SearchApiElasticsearchElastica.inc
Overrides __construct().

File

modules/elastica/search_api_elasticsearch_elastica.module, line 37
Provides an elasticsearch-based service class for the Search API.

Code

function search_api_elasticsearch_elastica_loaded() {
  $loaded =& drupal_static(__FUNCTION__);
  if (!isset($loaded)) {
    if (!class_exists('\\Elastica\\Client') && module_exists('composer_manager')) {
      drupal_load('module', 'composer_manager');
      composer_manager_register_autoloader();
    }
    elseif (!class_exists('\\Elastica\\Client')) {
      spl_autoload_register('_search_api_elasticsearch_elastica_autoload');
    }
    $loaded = class_exists('\\Elastica\\Client');
  }
  return $loaded;
}