function elasticsearch_connector_cluster_save in Elasticsearch Connector 7
Same name and namespace in other branches
- 7.5 elasticsearch_connector.module \elasticsearch_connector_cluster_save()
- 7.2 elasticsearch_connector.module \elasticsearch_connector_cluster_save()
Save a cluster configuration object.
Parameters
stdclass $cluster: The ElasticSearch cluster configuration object. This object should be loaded with elasticsearch_connector_cluster_load() or elasticsearch_connector_cluster_load_all()--otherwise, it is assumed to be a new configuration.
1 call to elasticsearch_connector_cluster_save()
- elasticsearch_connector_edit_cluster_submit in ./
elasticsearch_connector.admin.inc - Handle the cluster add/edit submissions.
File
- ./
elasticsearch_connector.module, line 594 - This module provide an interface to connecting to the elasticsearch cluster and implementing the official Elasticsearch library.
Code
function elasticsearch_connector_cluster_save($cluster) {
ctools_include('export');
$cluster = (object) $cluster;
$cluster->options = serialize($cluster->options);
if (isset($cluster->export_type) && $cluster->export_type & EXPORT_IN_DATABASE) {
// Record exists in the database.
$result = drupal_write_record('elasticsearch_connector_cluster', $cluster, 'cluster_id');
}
else {
// Record is new, or exists only in code.
$result = drupal_write_record('elasticsearch_connector_cluster', $cluster);
}
}