You are here

function acquia_spi_get_platform in Acquia Connector 7

Same name and namespace in other branches
  1. 6.2 acquia_spi/acquia_spi.module \acquia_spi_get_platform()
  2. 6 acquia_spi/acquia_spi.module \acquia_spi_get_platform()
  3. 7.3 acquia_spi/acquia_spi.module \acquia_spi_get_platform()
  4. 7.2 acquia_spi/acquia_spi.module \acquia_spi_get_platform()

Gather platform specific information.

Return value

An associative array keyed by a platform information type.

1 call to acquia_spi_get_platform()
acquia_spi_get in acquia_spi/acquia_spi.module
Gather site profile information about this site.

File

acquia_spi/acquia_spi.module, line 98
Send site profile information (SPI) and system data to Acquia Network.

Code

function acquia_spi_get_platform() {

  // Webserver detection is based on name being before the slash, and
  // version being after the slash.
  preg_match('!^([^/]+)(/.+)?$!', $_SERVER['SERVER_SOFTWARE'], $webserver);
  $platform = array(
    'php' => PHP_VERSION,
    'webserver_type' => isset($webserver[1]) ? $webserver[1] : '',
    'webserver_version' => isset($webserver[2]) ? $webserver[2] : '',
    'database_type' => db_driver(),
    'database_version' => Database::getConnection()
      ->getAttribute(PDO::ATTR_SERVER_VERSION),
    'system_type' => php_uname('s'),
    // php_uname() only accepts one character, so we need to concatenate ourselves.
    'system_version' => php_uname('r') . ' ' . php_uname('v') . ' ' . php_uname('m') . ' ' . php_uname('n'),
  );

  // Never send NULL (or FALSE?) - that causes hmac errors.
  foreach ($platform as $key => $value) {
    if (empty($platform[$key])) {
      $platform[$key] = '';
    }
  }
  return $platform;
}