function _acquia_search_set_version in Acquia Connector 8
Same name and namespace in other branches
- 7.3 acquia_search/acquia_search.module \_acquia_search_set_version()
- 7.2 acquia_search/acquia_search.module \_acquia_search_set_version()
Helper function to cache the Acquia Search version.
2 calls to _acquia_search_set_version()
- acquia_search_install in acquia_search/
acquia_search.install - Implements hook_install().
- acquia_search_requirements in acquia_search/
acquia_search.install - Implements hook_requirements().
File
- acquia_search/
acquia_search.install, line 126 - Install, update, and uninstall functions for the Acquia Connector module.
Code
function _acquia_search_set_version() {
// Cache the version in a variable so we can send it at not extra cost.
$version = \Drupal::config('acquia_search.settings')
->get('version');
$info = \Drupal::service('extension.list.module')
->getExtensionInfo('acquia_search');
// Send the version, or at least the core compatibility as a fallback.
$new_version = isset($info['version']) ? (string) $info['version'] : (string) \Drupal::VERSION;
if ($version != $new_version) {
\Drupal::configFactory()
->getEditable('acquia_search.settings')
->set('version', $new_version)
->save();
}
}