You are here

public static function Storage::getVersion in Acquia Search 3.x

Get Acquia Search Solr module version.

Return value

string Acquia Search Solr module version.

3 calls to Storage::getVersion()
acquia_search_requirements in ./acquia_search.install
Implements hook_requirements().
SearchSubscriber::preExecuteRequest in src/EventSubscriber/SearchSubscriber.php
Build Acquia Search Solr Authenticator.
StorageTest::testStorage in tests/src/Unit/Helper/StorageTest.php
Tests storage.

File

src/Helper/Storage.php, line 60

Class

Storage
Class Storage.

Namespace

Drupal\acquia_search\Helper

Code

public static function getVersion() : string {
  if (!($version = \Drupal::state()
    ->get('acquia_search.version'))) {
    $info = \Drupal::service('extension.list.module')
      ->getExtensionInfo('acquia_search');

    // Send the version, or at least the core compatibility as a fallback.
    $version = (string) ($info['version'] ?? \Drupal::VERSION);
    \Drupal::state()
      ->set('acquia_search.version', $version);
  }
  return $version;
}