You are here

private function SpiController::getVersionInfo in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 src/Controller/SpiController.php \Drupal\acquia_connector\Controller\SpiController::getVersionInfo()
  2. 3.x src/Controller/SpiController.php \Drupal\acquia_connector\Controller\SpiController::getVersionInfo()

Attempt to determine the version of Drupal being used.

Note, there is better information on this in the common.inc file.

Return value

array An array containing some detail about the version

1 call to SpiController::getVersionInfo()
SpiController::get in src/Controller/SpiController.php
Gather site profile information about this site.

File

src/Controller/SpiController.php, line 785

Class

SpiController
SPI Controller class.

Namespace

Drupal\acquia_connector\Controller

Code

private function getVersionInfo() {
  $server = \Drupal::request()->server
    ->all();
  $ver = [];
  $ver['base_version'] = \Drupal::VERSION;
  $install_root = DRUPAL_ROOT;
  $ver['distribution'] = '';

  // Determine if this puppy is Acquia Drupal.
  acquia_connector_load_versions();
  if (IS_ACQUIA_DRUPAL) {
    $ver['distribution'] = 'Acquia Drupal';
    $ver['ad']['version'] = ACQUIA_DRUPAL_VERSION;
    $ver['ad']['series'] = ACQUIA_DRUPAL_SERIES;
    $ver['ad']['branch'] = ACQUIA_DRUPAL_BRANCH;
    $ver['ad']['revision'] = ACQUIA_DRUPAL_REVISION;
  }

  // Determine if we are looking at Pressflow.
  if (defined('CACHE_EXTERNAL')) {
    $ver['distribution'] = 'Pressflow';
    $press_version_file = $install_root . './PRESSFLOW.txt';
    if (is_file($press_version_file)) {
      $ver['pr']['version'] = trim(file_get_contents($press_version_file));
    }
  }
  elseif (is_dir($install_root . '/profiles/openatrium')) {
    $ver['distribution'] = 'Open Atrium';
    $version_file = $install_root . 'profiles/openatrium/VERSION.txt';
    if (is_file($version_file)) {
      $ver['oa']['version'] = trim(file_get_contents($version_file));
    }
  }
  elseif (is_dir($install_root . '/profiles/commons')) {
    $ver['distribution'] = 'Commons';
  }
  elseif (is_dir($install_root . '/profiles/cod')) {
    $ver['distribution'] = 'COD';
  }
  return $ver;
}