You are here

function acquia_spi_boot in Acquia Connector 6.2

Same name and namespace in other branches
  1. 7.3 acquia_spi/acquia_spi.module \acquia_spi_boot()
  2. 7.2 acquia_spi/acquia_spi.module \acquia_spi_boot()

Implements hook_boot().

File

acquia_spi/acquia_spi.module, line 86
Send site profile information (NSPI) and system data to Acquia Insight.

Code

function acquia_spi_boot() {

  // Store server information for SPI incase data is being sent from PHP CLI.
  if (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0)) {
    return;
  }

  // Get the last time we processed data.
  $last = variable_get('acquia_spi_boot_last', 0);

  // 60 minute interval for storing the global variable.
  $interval = variable_get('acquia_spi_cron_interval', 60);

  // Determine if the required interval has passed.
  $now = time();
  if ($now - $last > $interval * 60) {
    $platform = acquia_spi_get_platform();
    acquia_spi_data_store_set(array(
      'platform' => $platform,
    ));
    variable_set('acquia_spi_boot_last', $now);
  }
}