You are here

function acquia_spi_get_platform in Acquia Connector 6

Same name and namespace in other branches
  1. 6.2 acquia_spi/acquia_spi.module \acquia_spi_get_platform()
  2. 7.3 acquia_spi/acquia_spi.module \acquia_spi_get_platform()
  3. 7 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 100
Send site profile information (SPI) and system data to Acquia Network.

Code

function acquia_spi_get_platform() {

  // Database detection depends on the structure starting with the database
  // 'type-name' => array('title' => 'name', 'value' => 'version-info') data.
  $database = db_status_report('');
  $database_type = array_shift(array_keys($database));

  // 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' => $database_type,
    'database_version' => $database[$database_type]['value'],
    '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;
}