function elasticsearch_connector_clusters in Elasticsearch Connector 7.2
Same name and namespace in other branches
- 7.5 elasticsearch_connector.module \elasticsearch_connector_clusters()
- 7 elasticsearch_connector.module \elasticsearch_connector_clusters()
Load all cluster objects.
Parameters
bool $include_inactive: Included inactive clusters. Defaults to true.
Return value
array An array of ElasticSearch connection cluster objects.
3 calls to elasticsearch_connector_clusters()
- elasticsearch_connector_cluster_load_all in ./
elasticsearch_connector.module - Prepare list of all clusters by status.
- elasticsearch_connector_status_page in ./
elasticsearch_connector.admin.inc - Cluster status page callback.
- elasticsearch_connector_views_views_data in modules/
elasticsearch_connector_views/ elasticsearch_connector_views.views.inc - Implementation of hook_views_data().
File
- ./
elasticsearch_connector.module, line 691 - This module provide an interface to connecting to the elasticsearch cluster and implementing the official Elasticsearch library.
Code
function elasticsearch_connector_clusters($include_inactive = TRUE) {
ctools_include('export');
$clusters = ctools_export_load_object('elasticsearch_connector_cluster', 'all');
// Filter out inactive clusters.
foreach ($clusters as $cluster_id => $cluster) {
// Unserialize the options if they are loaded from database.
// If they are loaded from exported object it will be array.
if (isset($cluster->options) && !is_array($cluster->options)) {
$cluster->options = unserialize($cluster->options);
}
if (!$include_inactive && !$cluster->status) {
unset($clusters[$cluster_id]);
}
}
drupal_alter('elasticsearch_connector_clusters', $clusters);
return $clusters;
}