elasticsearch_connector.install in Elasticsearch Connector 8
The installation file for elasticsearch_connector module.
File
elasticsearch_connector.installView source
<?php
/**
* @file
* The installation file for elasticsearch_connector module.
*/
/**
* Implements hook_requirements().
*
* Check Elastica installation.
*/
function elasticsearch_connector_requirements($phase) {
if ($phase === 'install') {
if (version_compare(phpversion(), '5.3.9', '<')) {
return array(
'elasticsearch_connector' => array(
'title' => t('The PHP version is not compatible with this module.'),
'description' => t('The module requires PHP version bigger than or equal to version 5.3.9.'),
'severity' => REQUIREMENT_ERROR,
'value' => t('PHP version not compatible.'),
),
);
}
}
if ($phase == 'runtime') {
if (!class_exists('\\Elasticsearch\\Client')) {
return array(
'elasticsearch_connector' => array(
'title' => t('The Elasticsearch library is missing.'),
'description' => t('The official library for Elasticsearch connection is missing.'),
'severity' => REQUIREMENT_ERROR,
'value' => t('Elasticsearch library missing.'),
),
);
}
else {
return array(
'elasticsearch_connector' => array(
'title' => t('Elasticsearch PHP library'),
'description' => t('The official Elasticsearch library was correctly installed.'),
'severity' => REQUIREMENT_OK,
'value' => t('OK'),
),
);
}
}
return array();
}
/**
* Implements hook_uninstall().
*
* Delete Search Api elasticsearch servers.
*/
function elasticsearch_connector_uninstall() {
//\Drupal::state()->delete('elasticsearch_connector_get_default_connector');
}
Functions
Name | Description |
---|---|
elasticsearch_connector_requirements | Implements hook_requirements(). |
elasticsearch_connector_uninstall | Implements hook_uninstall(). |